65 Posts
Wissner
4 years ago
4
Topic

I made a registration form, with some options for the user.

If the user selects "student", a field "subject" becomes visible. This field should be required, but only if the field "student" is selected respectively "subject" is visible.

As it is now, if I make "subject" required, the form complains even if the field isn't visible.

Is there a possiblity to make the field required, but only if it is visible?

Thank you

Wolfgang

Get a VIP membership
65 Posts
Wissner
4 years ago
1
Level 1

This article is marked as solved, but I did this by mistake.

My problem is still unsolved. Unfortunately I cant reset this.

So if anyone has a hint or solution for me, please post it.

Thank you

Wolfgang

1283 Posts
Bucklash
4 years ago
0
Level 2

this might do it with a bit of effort:

have field_subject in surrounding field_div (because hiding field_subject might impact what you can do with it)

field_div has conditional: if field_student is certain value then field_div has class .show.

and have conditional on field_subject: if field_student does not have certain value then is filled with “0”

something like that anyway.

or check out the conditionals js that seblod outputs

copy and pate it in to your custom.js , remove the the conditionals, and rewrite it with if statements etc and output it yourself

65 Posts
Wissner
4 years ago
0
Level 1

Thank you Bucklash,

I think I will try to use the CSS-Classes. Some define a required state of a field. So I should be able to change this by javascript.

:-)

44 Posts
StanislavR
4 years ago
0
Level 1

Hi, If it is interesting 

I made 2 conditions for a required* field:

Hidden and Disabled

It works

Get a Book for SEBLOD