19 Posts
gorgonz
5 years ago
2
Topic

I use an email field of type optional (but validated as email). In addition there is already a condition, so that this field is filled, if another field "want a copy" is selected.

Now I would like to change the type from optional to required, if a third field (bool) is selected.

What I tried:

I edited the trigger conditions (5) of the email field and added a completely new condition: if third field is yes then "has class" is "required". "required" is entered in field "B" according to the tutorial (https://www.seblod.com/resources/manuals/advanced/playing-with-conditional-states-triggers).

Well, it doesn't work ;-)

Is it a wrong approach or even a bug?

Any hints are very welcome :-)

[UPD] Well, I used the firefox debugger meanwhile. Now I see, that the class "required" is set in dependency of the third field. So my approach is the wrong way, to get it a required field ;-). Any ideas, how to do it in the right way?

Get a Book for SEBLOD
5 years ago
1
Level 1

Hi gorgonz,

to have the required on your field, you need to add to this field the class validate[required]

So you can add the condition " has Class" on your field when your third field is equal to what you want: 

Regards.

19 Posts
gorgonz
5 years ago
0
Level 2

Thx a lot, Lionel for this hint :-)

Tried it already, it kinda works, though there is no notification to the user in case, that email field is not filled. He/She will not know, that the form was not transmitted. I must take a closer look at this ;-)

Get a VIP membership