Form validation - hidden input fields

799 views
Skip to first unread message

Nick Carpenter

unread,
Apr 13, 2015, 7:37:20 AM4/13/15
to seman...@googlegroups.com
Hi there,

I have a form that I'm trying to validate with Semantic UI.  In this form I have fields that are not visible (which are only shown if a user selects certain options).

Semantic UI is trying to validate these hidden fields along with everything else - which I don't want. I just need any visible fields to be validated.

Any ideas on how I can achieve this?

Many thanks,

Nick

Charles Grisar

unread,
Apr 15, 2015, 3:37:34 AM4/15/15
to seman...@googlegroups.com
Hi Nick,

can you please send your code?

First impression: you need to adapt the validation rules

On my side, I tend to use an ajax call and perform the validation on the server.
I feel that it better keeps all the business logic together.

C

Op maandag 13 april 2015 13:37:20 UTC+2 schreef Nick Carpenter:

David Jurado

unread,
Oct 28, 2015, 11:07:46 PM10/28/15
to Semantic UI
I have the very same problem, semantic is literally validation every single field in the form whether it's visible or not, and the docs do not show a way neither to implement such a specific validation or to adapt any sort existing of validation to ignore non-visible form fields.

Has anyone found any way to accomplish this or knows of an article or something addressing this problem?

Nick Carpenter

unread,
Feb 3, 2017, 8:18:51 AM2/3/17
to Semantic UI
Hi David,

Sorry for the hugely late reply!  I did find a way to accomplish this eventually - but not in the way I thought I might.

Semantic-UI only validates form fields that are not disabled, so I just made sure that and hidden fields (or fields that became hidden as the user interacts with the form) have the 'disabled' property set to true using jquery.

Boom. Works a treat!

Nick
Reply all
Reply to author
Forward
0 new messages