data['oudersessieouder2'] == 'ja' ) { $form->data['redirect_url'] = JUri::root().'inschrijven-pe-jongeren-both-parents.html';} elseif ( $form->data['oudersessieouder1'] == 'ja' || $form->data['oudersessieouder2'] == 'ja' ) { $form->data['redirect_url'] = JUri::root().'inschrijven-pe-jongeren-1-parent.html';} else { $form->data['redirect_url'] = JUri::root().'inschrijven-pe-jongeren.html';}?>I have some knowledge in php, but les sin chronoforms. What am I doing wrong? Doesn't it recognize $form? Important: the website uses Chronoforms 3.1"> Go to different url depending on value of 2 dropdowns - Forums

Forums

Go to different url depending on value of 2 dropdowns

kevinverhoeven 26 Feb, 2015
I'm building a form for an organisation that organises a workshop for teenagers. There is an option to bring one or both parents to the workshop. So for each parent, there's a dropbox to answer the question "Will you participate in the workshop as well?" Depending if one, both or no parents will join, the user will be redirected to a different url after submiting (submit is always in the same place). The form is built with chronoforms in Joomla.

This is the code for the dropdowns, please note that I can't change the values "Ja" or "Nee" because this value is also sent to a database and i'm not allowed to change it. Code for the dropdowns:

<select class="cf_inputbox validate-selection required" id="select_17" size="1" title="verplicht veld" name="oudersessieouder1" style="width: 193px;">
    <option value="">Make your choice</option>
<option value="Ja">Yes, will participate</option>
<option value="Nee">No, will not participate</option>
    </select><label class="cf_label" style="width: 150px;"> Will this parent join the workshop?</label>

<select class="cf_inputbox validate-selection required" id="select_18" size="1" title="verplicht veld" name="oudersessieouder2" style="width: 193px;">
    <option value="">Make your choice</option>
<option value="Ja">Yes, will participate</option>
<option value="Nee">No, will not participate</option>
    </select><label class="cf_label" style="width: 150px;"> Will this parent join the workshop?</label>


Now I need the On Submit code after sending mail, this is my try at it, but it doesn't work, so...:


<?php
if ( $form->data['oudersessieouder1'] == 'ja' && $form->data['oudersessieouder2'] == 'ja' ) {
  $form->data['redirect_url'] = JUri::root().'inschrijven-pe-jongeren-both-parents.html';
} elseif ( $form->data['oudersessieouder1'] == 'ja' || $form->data['oudersessieouder2'] == 'ja' ) {
  $form->data['redirect_url'] = JUri::root().'inschrijven-pe-jongeren-1-parent.html';
} else {
  $form->data['redirect_url'] = JUri::root().'inschrijven-pe-jongeren.html';
}
?>


I have some knowledge in php, but les sin chronoforms. What am I doing wrong? Doesn't it recognize $form? Important: the website uses Chronoforms 3.1
GreyHead 26 Feb, 2015
Answer
Hi kevinverhoeven,

Haven't you already asked this question - it looks very familiar?

Hmmm ChronoForms 3.1 is now very old, and didn't use the $form->data syntax. Instead you get the form results using the Joomla! JRequest methods. It will be something like:
<?php
$oudersessieouder1 = JRequest::getString('oudersessieouder1', '', 'post');
. . . 
Then you can use that value in place of the $form->data one.

Bob
kevinverhoeven 26 Feb, 2015
I encountered this problem very recently, I don't think i posted before. If i did, I'm sorry. The website is also pretty old, but it's not my responsibility in this case. So Chrono Forms V4 and V5 do use the normal php syntax?

I'll try the code asap (on submit, right?), I'll get back if it works... and if it doesn't as well probably 🙂
This topic is locked and no more replies can be posted.