Page 1 of 1

Question for the Formbuilder - Professionals

Posted: Fri Mar 01, 2019 5:25 pm
by Hupi
Hi,

propably this is an easy one but I could not find a solution until now:

I have 2 dropdown fields in a form.

Example:
Field 1 contains "Apple", "Banana", "Tomato"
Field 2 contains "Box", "Basket"

Now, every combination is selectable by default. What I would like to accomplish is, that 1 specific combination is not allowed / selectable, or at least that the form cannot be sent and I get a error message.

Example:
Field 1 = "Banana" & Field 2 = "Box" is not an allowed combination and should not be accepted.

Question:
- How can I do something like that?
- Do I need to use a specific (different) field type ?
- Or is the only way to check for these values when the "Send"-Button is clicked ?

Thanks for pointing me in the right direction.
BR Hupi

Re: Question for the Formbuilder - Professionals

Posted: Fri Mar 01, 2019 6:07 pm
by calguy1000
The simplest way to handle this would probably be some javascript in the form template.

Otherwise, you would need a UDT to do the validation and throw an error.

Re: Question for the Formbuilder - Professionals

Posted: Fri Mar 01, 2019 8:52 pm
by velden
Not exactly the same but it might help you: http://tinyurl.com/yy9k6e5a

The 'THEMA' (theme) dropdown is only filled after selecting a 'DATUM' (date). Also, if the selected date is changed, the theme dropdown is updated and a new selection needs to be made.

That's an example with javascript and calguy's module CGBetterForm. I think it can be done with FormBuilder too.
Javascript validation is nice but if you absolutely don't want 'malicious' orders in your backed you must do server side validation too (I do it in this case).

Look at the page's source and the linked res_form.js to understand what's happening (probably can be improved).

I think I generate the javascript themes and eventdates vars from within a LISE instance. But could be a UDT as well.

Re: Question for the Formbuilder - Professionals

Posted: Sun Mar 03, 2019 9:56 pm
by Hupi
Hi friends,

ok, thanks for your inputs. Will try to sort that out and - in case I find a good way - post the solution here.

Well ... it may take a while since its not exactly urgend but will stay on it. 8)

BR
Hupi