Question for the Formbuilder - Professionals

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
Hupi
Forum Members
Forum Members
Posts: 16
Joined: Fri Dec 25, 2015 4:03 pm

Question for the Formbuilder - Professionals

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: Question for the Formbuilder - Professionals

Post 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.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3483
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: Question for the Formbuilder - Professionals

Post 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.
Hupi
Forum Members
Forum Members
Posts: 16
Joined: Fri Dec 25, 2015 4:03 pm

Re: Question for the Formbuilder - Professionals

Post 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
Post Reply

Return to “Modules/Add-Ons”