form validation problem in conditional field #127

Closed
opened 2017-09-27 20:34:08 +00:00 by sepehr09 · 4 comments
sepehr09 commented 2017-09-27 20:34:08 +00:00 (Migrated from github.com)

Hi
One issue that I have noticed today is when i use conditional field ( Editing the Admin View -> Conditions) , all fields used in Conditions have problem with front-end validation. i checked that fileds required="false" att is set correctly but if those field leave empty the validation give me error (front-end).
thank you

Hi One issue that I have noticed today is when i use conditional field ( Editing the Admin View -> Conditions) , all fields used in Conditions have problem with front-end validation. i checked that fileds required="false" att is set correctly but if those field leave empty the validation give me error (front-end). thank you
ro-ot commented 2017-09-27 21:18:13 +00:00 (Migrated from github.com)

You must always add one more hidden field to the view to insure that it can work to pass the server side validation.

So it is a hidden field and the field xml looks like this

<field 
	type="hidden" 
	name="not_required" 
	default="[]" 
/>

Just add it to any page that use the conditional feature and it should resolve the validation problem.

You must always add one more hidden field to the view to insure that it can work to pass the server side validation. So it is a hidden field and the field xml looks like this ``` <field type="hidden" name="not_required" default="[]" /> ``` Just add it to any page that use the conditional feature and it should resolve the validation problem.
sepehr09 commented 2017-09-28 09:26:03 +00:00 (Migrated from github.com)

Thank you very much,
i put that hidden field to my form but still client-side validation give me error :
image

(the first name & last name not required but validation give me error)

Thank you very much, i put that hidden field to my form but still client-side validation give me error : ![image](https://user-images.githubusercontent.com/11753906/30959138-22f5933e-a44c-11e7-999f-35372a01f59c.png) (the first name & last name not required but validation give me error)
sepehr09 commented 2017-09-28 12:20:47 +00:00 (Migrated from github.com)

i found the solution! if i'm use (required="false" ) the validation will not work correctly in conditional form (client-side validation) , if leave required empty (required="" ) the problem will be resolved!

i found the solution! if i'm use (required="false" ) the validation will not work correctly in conditional form (client-side validation) , if leave required empty (required="" ) the problem will be resolved!
ro-ot commented 2017-09-28 12:29:40 +00:00 (Migrated from github.com)

Yes sure, or you can just remove the line altogether.

Yes sure, or you can just remove the line altogether.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#127
No description provided.