Forums

[SOLVED] Syntax for Redirect URL variables

dmontpe 09 Aug, 2011
Hi. I'd like to know what is right syntax for variables to be passed in the Redirect URL action in CFv4.

I've got the Redirect URL and Redirect User actions in place and I've been trying different ways to set the form fields to be passed but none seems to work. The form redirects alright but form field contents are not passed as parameters.

What is the right syntax?

David
GreyHead 11 Aug, 2011
Hi David,

Multi line format of the Redirect field names; use {} curly brackets for form results:
e.g:
param_name_1={form_field_name}
param_name_2=some_value


Bob
dmontpe 12 Aug, 2011
Then I guess I've got it right but I get no values in the URL.

I have a field 'dis' in my form and I have 'dis={dis}' (no quotes) in the parameters, but when I submit the form, I get 'dis=' in the URL.

Any ideas?
GreyHead 13 Aug, 2011
Hi David,

No idea, it should work as far as I know. Please take a Form Backup using the icon in the Forms Manager and post it here (as a zipped file) or PM or email it to me and I'll take a closer look.

Bob
dmontpe 15 Aug, 2011
I just PMed it to you, thank you.
GreyHead 15 Aug, 2011
Hi David,

Strange as it may seem it is working perfectly. It passes the values of the checkbox inputs in the URL and the values are all set to '' i.e. nothing.

Change the input values to for example value='dis' and it works as you expect.

Bob

PS Because unchecked checkboxes return nothing you can avoid some potential error messages by adding a Custom Code action with this code in it.
<?php
$checkboxes = array('dis', 'com', 'lis', 'mar');
foreach ( $checkboxes as $v ) {
  if ( !isset($form->data[$v]) ) {
    $form->data[$v] = '';
  }
}
?>
dmontpe 15 Aug, 2011
Hi, Bob.

Thanks for looking at it. I don't get it then. Whatever box I check is passed as blank! For instance, I checked the first two boxes, and the url it redirects me to is

myurl&dis=&com=

Just like that.

I've tested it in both Chrome and Firefox with the same result.

What's wrong?
GreyHead 15 Aug, 2011
Hi David,

Have you added the missing values to the Form HTML?

Once they are in place it works OK for me.

Bob
dmontpe 15 Aug, 2011
Silly me, I get it now. I thought that the values for a checkbox where automatically filled with a boolean type value (1 or 0).

I just figured out the problem. So I have just added the 1 value to all boxes and is working fine. Thank you, Bob, for helping silly boys like me.


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