?
avatar joboca
joboca
15 Mar 2016

Hi @andrepereiradasilva ,

Is there a solution to use a required field that depends on the selection of another field with showon?

Although the required field is not visible it is verified on the form.

<field
name="field1"
type="checkboxes"
default="0"
label="Field1">
<option value="0">JNO
<option value="1">JYES
</field>

<field
name="field2"
type="text"
label="Field2"
required="true"
showon="field1:1" />

Thank you!

avatar joboca joboca - open - 15 Mar 2016
avatar andrepereiradasilva
andrepereiradasilva - comment - 15 Mar 2016

@brianteeman this is not an issue. can this be closed

Reggarding your question, I think so, but will only work on 3.5.0+.
Maybe with, showon="field1:whatever[AND]field2:whatever" on the third field

avatar Bakual
Bakual - comment - 15 Mar 2016

We only hide the field using CSS, thus the field is still there.
You can't have a required field which is invisible. You would have to add own JS logic to remove the required attribute/class when hidden if you need that.

I'm closing this issue as I don't think that is something which core needs to do.

avatar Bakual Bakual - change - 15 Mar 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-03-15 12:06:45
Closed_By Bakual
avatar Bakual Bakual - close - 15 Mar 2016
avatar brianteeman brianteeman - close - 15 Mar 2016
avatar brianteeman brianteeman - change - 22 Apr 2016
Labels Added: ?

Add a Comment

Login with GitHub to post a comment