renvrant / conditionize.js

Small jQuery plugins for handling conditional form fields via data attributes. Unmaintained.
MIT License
53 stars 30 forks source link

Field Name with Spaces #25

Closed CodeCurosity closed 5 years ago

CodeCurosity commented 5 years ago

I have a field name="First Name" , it has a space in it but conditionize is throwing an error as it is unexpected, any solution so it works with names with spaces?

IsmailM commented 5 years ago

Looking at the code, it would be very difficult to add support for spaces in the name (which isn't even supported under strict HTML5 standard).

See text from the home page:

Supported names/ids: Any string consisting of lower and upper case letters(a-z and A-Z), digits(0-9), underscores(_) and hyphen(-). At least one character(a-z or A-Z) is required.

NOTE: This is different from HTML5 standard. HTML5 allows any character except any type of space character. And, it must not be empty string.

NOTE: Strings inside double or single quotes are ignored, i.e. you can even write a condition like "myInputName == 'myInputName'"

CodeCurosity commented 5 years ago

Thanks but i am actually using Label Names as Field Names so users can easily get names from the form in preview, i will see if i can find a workaround.

rguliev commented 5 years ago

I'm closing the issue because spaces are not even in HTML5 standard. But I would love to hear from you if you find a workaround