Conditional fields on a Form

Saumier

Member
J 2.5.7 F 3.0.6
I have a form that registers a person for an event and does a Paypal. That works great. This is what I would like to do:

If an address is entered, continue asking for city, state, etc. If address is blank and user tabs to next field, skip to a field "rules".

Secondly, I have a radio-button (No=0 Yes=1) at the end of the form that asks if they want to purchase now. If No, save the record and exit the form. If Yes, run the Paypal plug-in. I have put the following in the Condition field in Paypal plug-in:

if (form_30.formElements.get('sky1_indoor___purchase').getValue() == '0');
return false;

This does not run Paypal, but it does not save the record.

Are these doable? I haven't been able to figure it out.

Thanks for any help.
 
I'm going to have to think about the first part (skipping to a specific field), but for the 'Condition' in PayPal, you need to use a PHP expression, not a JavaScript expression.

Try this:

PHP:
$yesno = JRequest::getVar('sky1_indoor___purchase');
if (is_array($yesno)) {
    $yesno = $yesno[0];
}
return $yesno != '0';

-- hugh
 
Thanks- you've come through again. It works great!!
Don't waste any time on "the first one". I was just wondering if you had more magic to do that.
Thanks again.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top