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
Form Builder - Is this even possible?
Re: Form Builder - Is this even possible?
You can do it with JS/jQuery.
Something like:
$(.checkbox input).onChange( function() {
$(.EandF input).each( this.value(this.value * 1.5) );
});
Something like:
$(.checkbox input).onChange( function() {
$(.EandF input).each( this.value(this.value * 1.5) );
});
Re: Form Builder - Is this even possible?
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:
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','');
}
});
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
Re: Form Builder - Is this even possible?
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...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).
... and not so simple too.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.
HTH
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Re: Form Builder - Is this even possible?
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
Cheers