Forums

Passing parameters to another form

batvink 22 Apr, 2013
Hello,

I am assessing Chronoforms for my site, so far it is looking fantastic and very powerful. I have a problem passing fields from one form to another. I have read many tips, how-to's and forum posts, but I'm missing something important, because it just isn't working for me.

Scenario
Enter 3 fields. Pass them to form 2, so they can be used to check for a database record to populate fields on forms 2 (including cf_id so the record can be updated)

Setup
Form1 contains 3 fields:
order (string)
name (string)
date (string)

Form2 containd many fields, and includes the fields from Form1, with the exact same names.

Method(s)

1. Just call Form2 from Form1 using Show Form Action. This should populate the fields through the POST data? It hasn't worked.

2. Add Multi Page Actions to all events. I'm not sure this should work, this is only for multiple pages in one form?

3. Add Session to Data and Data to Session Actions in the On Submit and On Load events respectively. This did not work so I added the same session key to each form. This also did not work.

4. Used custom code, but this showed blank data. For example:

$form -> data['order'] = JRequest::getString('order', '', 'post');
echo ">> " .  $form -> data['order'];


5. Set the Form to GET instead of the default POST. This proved that the parameters are being passed. However, it removes the parameters that load the correct form, so it takes me back to the home page. Maybe this is because of SEF URLs or other incompatible site setup.

6. I have removed all authentication to try and make it work.

As you can see, I think I have tried all the tips found on this site. Can anyone tell me what I have missed?
GreyHead 22 Apr, 2013
Hi batvink,

Use the Session/Data actions with the shared Session Key. Please add a Debugger action to the On Submit event of the first form and the On Load event of the second form to see what is happening.

Bob
batvink 22 Apr, 2013
Thanks for the quick response.

I'm not sure how you view the data of a debugger action for the "On Submit", because you leave the page?

On the second form, I get:

Data Array: 
Array
(
    [option] => com_chronoforms
    [amp;chronoform] => signoff
    [amp;event] => load
    [chronoform] => signoff
    [event] => load
    [Itemid] => 
)
Validation Errors: 
Array
(
) 


I have set "Reset" to "NO".
The session key is "signoffKey" for both forms.

I have now tested in both Chrome and Internet Explorer 10. I get the same result in both.

To confirm my fields, here are the order fields in both forms:

<input maxlength="30" size="30" class=" validate['required','alphanum']" title="Works Order" type="text" value="" name="works_order">


<input maxlength="30" size="20" class="" title="Works Order" type="text" value="" name="works_order">
batvink 22 Apr, 2013
I can also see the data made it to Form 2. Chrome Network Tools allows me to look at the POSTed data.
So it seems like a problem with Form 2 not moving the parameters into the fields.
I still have a problem, but maybe this will help somebody to help me?

contractor_name:Joe Bloggs
works_order:TEST123
day1_date:2013-04-22
submit:Continue
885446c78959555831c13737ba034ff0:1


[EDIT]

I have found I can fix the problem in the Show Form event...almost.
I change the action from Redirect Form to Load Form.

This now loads the fields up correctly. The only "glitch" is that the copyright notice gets repeated each time you move to the next form. So you can get many copyright notices. I'm very happy to show that I am using Chronoforms...but not so many times!

Nearly there...maybe somebody has seen this small problem before?
GreyHead 23 Apr, 2013
Hi batvink,

It sounds as though there is still something odd with the session handling here. The nested strap-lines are because you are in effect loading the second form in the same page as the first one. ReDirect is the setting I would expect to use.

Bob
This topic is locked and no more replies can be posted.