You are viewing limited content. For full access, please sign in.

Question

Question

Forms - javascript can access fields hidden by field rules now? How do I only access the fields that are shown?

asked on October 1, 2021 Show version history

Running some tests and finding that I can see a field hidden by a field rule with javascript, always thought they were removed entirely. If I console.log($('.myField input')); each time I change the trigger field for the rule which hides/shows it, each time the field definition is put into the console.

For a multi-language form I only want to access the fields displayed by field rules for the language chosen.

For example if I want to access $('.gender input') I don't want to pick up the English field if Spanish is chosen.

I am looking for solution that does not involve explicit hard coded if(lang="English)else(if lang="Spanish) because this will not work as new languages are added to the form by someone that doesn't know javascript.

My goal with scripting is to add the feature they need that might be missing from the designer, without them having to know how to alter the script directly.

0 0

Replies

replied on October 8, 2021 Show version history

Try testing for the class "hidden"
https://api.jquery.com/hasClass/#hasClass-className

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.