DB actions both on load and on subumit

Piszi 09 Jul, 2012
Hello,

I'm working on a project for J2.5 and I need a form for update status in 3 different table and insert into one. I kinda copied virtuemart 2 order DB structure.
First when the page loads I want to display the event or events which the user needs to confirm.
The required parameters for the onload query is passed trough with a link and for the update and insert there will be 2 radio button one with accept and one with declane.
But I'm wondering what CF action should I use, custom code or inbuilt BD actions?
Or is this possible at all with CF ?

Thanks in advance.
GreyHead 09 Jul, 2012
Hi Piszi,

You haven't given much detail here so hard to be exact.

A DB Record Loader action in the ON Load event can use data from the URL.

You can use multiple DB Save actions in the On Submit event. Making them conditional can be a little more complicated. My Event Switcher action may help with this.

If you are familiar with the Joomla! DB Code you can also write your own queries but this can be more work that using the ChronoForms actions.

Bob
Piszi 09 Jul, 2012
Thanks for the answer.

In detail I'm making an Event and Workshop registration component because I did not finde one on JED which fits for me, and it is almost ready but than it came up that the users should confirm or cancel their event registration(s). And because I'm almost ready I don't want to rewrite the whole code. So I come up with the idea why not use CF for the confirmation.
Basicly the confirm. will show the event(s) which the use subscribed than a textbox where the user can input a cupon code or ticket code than two radio button one for confirm and one for cancel and a text area for comment and of course a submit button.
Because it's almost works like a shopping cart so I kinda copyed VM2 DB structure so It stores the subscriptions In different DB tables:
1. subs (in VM2= virtuemart_orders)
2. subs_items (in VM2= virtuemart_order_items)
3. subs_state (in VM2= virtuemart_orderstates)
4. subs_userinfo (in VM2= virtuemart_order_userinfos)
And the subscription state is stored in 3 table like in VM2 except I don't have an order history table but I'm considering making one because of the cupon/ticket code🙂

The first query which should run onload is something like this:

$query = "SELECT `subs_item_name` , `subs_item_place` , `subs_item_start` , `subs_item_end` , `subs_item_type`
FROM `m01jm_mevr_subs_items`
LEFT JOIN `m01jm_mevr_subs` ON `m01jm_mevr_subs_items`.`subs_id` = `m01jm_mevr_subs`.`mevr_subs_id`
WHERE `m01jm_mevr_subs`.`subs_number` = '".$num."'
AND `m01jm_mevr_subs`.`subs_pass` = '".$pass."'";

And $num & $pass is from the the URL which the user clicked.

I already made the first query in CF but I think I did something wrong because my content area double in size as it should be🙂
GreyHead 10 Jul, 2012
Hi Piszi,

The query looks OK as far as I can tell. But I have no idea what this means: "content area double in size as it should be"??

Bob
Piszi 10 Jul, 2012
Oh that means somehow the content area (where I load the components in my template) is wider than it should be when I click the link and CF loads. But I think I made a mistake in the HTML code, but I didn't had time to check what I did wrong🙂
This topic is locked and no more replies can be posted.