Forums

Dynamic Required Option

giacall 10 Jul, 2015
Hi to all.
I need a little help.

I have dropdown with some option. One of these options is other.

When the user select "other" option, 2 text box are showed.
How can i set these 2 text box as "REQUIRED" only if user select "OTHER"option in dropdown menu?

Thank's in advance
GreyHead 11 Jul, 2015
Hi giacall,

I think that if you make them Required they will work as you want. If I remember correctly, when they are hidden the validation is ignored.

Bob
giacall 14 Jul, 2015
Hi BOB.

Thank for replay.

Unfortunately... No... It seems if they are marked as required, the user must fill the field, also if they are hidden (parent hidden mode).

Time ago.. I seem to remember i've found a post on HOw To set the option DISABLED, REQUIRED, HIDDEN by code (PHP or JS).


But i can not find it anymore...
giacall 21 Jul, 2015
:roll: Nobody can help me??


Luca
GreyHead 22 Jul, 2015
Hi giacall,

When I test it works correctly, the hidden input is not shown as required.

Please post a link to the form so I can take a quick look.

Bob
giacall 22 Jul, 2015
Hi Bob thank for your time.

I'll send in a PM the link , ID and password to log in .

The menu to use is Nota Spese.

The field with issue is TIPO PAGAMENTO.
In this field, if you select carta, then other dropdown carta credito required is shown.
otherwise if you select contanti or bancomat, no other field are shown.

If you select contanti and then you try to submit, nothing happen. If you select carta and then select the correct carta di credto field, the submit work fine.

Thank you
GreyHead 22 Jul, 2015
Hi giacall,

Please try adding some options to the Carta drop-down.

I have built a little test form here and the validation is not used if the inputs are hidden.

Bob
giacall 22 Jul, 2015
Hi Bob.

I try to add one more option both TIPO PAGAMENTO and CARTA CREDITO, but nothing has changed.

I forgot to say that this 2 dropdown (TIPO PAGAMENTO and CARTA CREDITO) are dynamic. They load data from DB.
To remove- modify-add options the user must use the GEST. TIPO PAGAMENTO and GEST. CARTA CREDITO menus
This topic is locked and no more replies can be posted.