Page 1 of 1
Form Builder - Is this even possible?
Posted: Wed Jun 24, 2015 1:55 am
by sandaha
I've been messing around with Form Builder and everything is working well. However, I have a requirement which is driving me crazy. Let's say I have a form like so:
Text field A
Text field B
Check boxes C, D, E
Text field F
Text field G
Now, what I need to happen is for Text fields F & G to change value depending on which check box the user selects (either C, D or E).
I have searched the forums to see if this has been addressed before but can't see anything. Does anyone have any suggestion or solutions for a feature like this?
TIA
Re: Form Builder - Is this even possible?
Posted: Wed Jun 24, 2015 9:05 pm
by Jeff
You can do it with JS/jQuery.
Something like:
$(.checkbox input).onChange( function() {
$(.EandF input).each( this.value(this.value * 1.5) );
});
Re: Form Builder - Is this even possible?
Posted: Wed Jun 24, 2015 9:17 pm
by JohnnyB
I usually handle that using a combination of backend and frontend technologies. The change of text field values that occurs when a checkbox is checked is handled (almost always) using Javascript.
Search for onchange events.
With jQuery, you can do things like:
Code: Select all
$('#the-checkbox-id-or-class').on('click', function() {
if ( $(this).is(':checked') || $(this).prop("checked") || $(this).attr('checked') ) {
// do something when it is checked - for example, $('#the-text-input-id').attr('value','the stuff you want to show in the text input');
} else {
// do something when it is not checked, like empty the text input... $('#the-text-input-id').attr('value','');
}
});
Re: Form Builder - Is this even possible?
Posted: Wed Jun 24, 2015 10:47 pm
by Jo Morg
sandaha wrote:Now, what I need to happen is for Text fields F & G to change value depending on which check box the user selects (either C, D or E).
Well it depends... if it needs to be visible and to allow people to be able to modify it before form submission the above suggestions are the way to go. If not...
FormBuilder's Help Page wrote:Computed Field. This allows you to embed a computed field in your form. It is not visible to the user until after the form is submitted. It allows you to do simple arithmetic or string concatenation.
... and not so simple too.
HTH
Re: Form Builder - Is this even possible?
Posted: Thu Jul 02, 2015 2:52 am
by sandaha
Thanks for the replies guys. Luckily I dodged a bullet this time and this feature won't be necessary after all. I've filed it for future needs.
Cheers