Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Execute extra on form submit 29 Oct 2012 22:57 #4837

Hello,

I am almost done with this component. I just need to add some code, but I need to know where to add it.

User Collection View:

- clicks on a link that allows the user to edit 1 field.
- user enters data, clicks save.

Now I need to run some extra PHP code, but just for that form. What and where is that controller?


Second item:

I have multiple Collection layouts for the same table. So, it is something like this:

Active | Expired | Trial

What I need to do is modify the SQL select for each one so that I can display the records correctly. For example:
SELECT FROM this_table WHERE expire_date < date('now')
This is for active licenses.


Can someone point me in the right direction to make these modifications?

Thanks :)
--
Jerry Benton

Please Log in or Create an account to join the conversation.

Last edit: by jcbenton.

Re: Execute extra on form submit 29 Oct 2012 23:56 #4841

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
I think what you need is listquery() - either that or prepareQuery()

It'll be in the controller for the collection you're working on...

Use $query->where etc to adapt the queries as required.

Sorry if a bit vague. Too tired to check ATM but can do tomorrow if this doesn't help.

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: Execute extra on form submit 29 Oct 2012 23:57 #4842

Ok, what file? :)

Go to bed. I will look at this tomorrow as well.
--
Jerry Benton

Please Log in or Create an account to join the conversation.

Re: Execute extra on form submit 30 Oct 2012 00:03 #4843

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Whatever the name of the controller for the layouts you're using...

Actually, you could just add a filter on the grid. Filter by the field holding expired, active etc... Then, you could even pass it in the URL if you wanted. That way, you technically have one layout...

Sure,

I'll take a look tomorrow. Btw are you using enum field or a fk for your different 'states' ( active etc)?

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: Execute extra on form submit 30 Oct 2012 00:06 #4844

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
components/com_yourcomponent/controllers/your_controller.php or
administrator/components/ com_yourcomponent/controllers/your_controller.php
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: Execute extra on form submit 30 Oct 2012 00:07 #4845

State is based on current date.

If timestamp < today it is expired.

I have an integer field for the "Trial". 1 = trial and 0 = no trial.

So to list trial licenses I just have to add:
WHERE trial='1'

For Active I need to add:
WHERE now() < expire_date

And for Expired:
WHERE now() > expire_date
--
Jerry Benton

Please Log in or Create an account to join the conversation.

Re: Execute extra on form submit 30 Oct 2012 00:08 #4846

Thanks. I will look at them tomorrow. I need to go sleep :)
--
Jerry Benton

Please Log in or Create an account to join the conversation.

Re: Execute extra on form submit 30 Oct 2012 08:37 #4851

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Did you get this sorted?
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Re: Execute extra on form submit 01 Nov 2012 11:12 #4883

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
models/xxxxs.php

function prepareQuery()
Coding is now a piece of cake
The following user(s) said Thank You: JoomGuy

Please Log in or Create an account to join the conversation.

Re: Execute extra on form submit 01 Nov 2012 11:25 #4887

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
Sorry @admin & @jcbenton - I told you to look in the controller, not the model!!!

That was silly but, I did say it was late!

Hope you got or get it sorted
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.076 seconds

First let me congratulate you on an excellent/outstanding product. Just tried for one hour but was very impressed.
Marret (Forum)

Get Started