- rsvpfreeAsked on February 21, 2015 at 04:24 PM
I would like my users to be able to enter into a text box alphanumeric data such as "123 Hi-Grade Apts, Anytown" but this gets rejected with Validation set to ALphaNumeric because of both the 'dash' in "Hi-Grade" and the 'comma' after "Apts".
Is there a way I can validate entries as AlphaNumeric while allowing punctuation?
- JotForm SupportabajanAnswered on February 21, 2015 at 08:34 PM
Thanks for asking. One workaround would be to set the validation back to the default (None) and add a notice under the field specifying which characters are not allowed. Next, create a condition to both show the notice and hide the submit button if any of those characters is included.
To better understand what I mean, please see this clone of your jotform. If any attempt is made to type certain characters into the Name of Group or Organisation: field, a notice appears under the field and the Create My Event button becomes hidden. (Once the submit button of a jotform is hidden, it cannot be submitted.) The forbidden characters in this case are:
! , @ , # , $ , % , ^ , * , ( and ).
If you clone the demo you'll see the following condition:
If you need clarification on anything, please let us know.
- rsvpfreeAnswered on February 22, 2015 at 04:10 AM
Thank you, abajan.
It looks like I can use this technique to "disallow" single characters like < and > or multiple-characters like &#
As you can guess, I am trying to prevent 'hacking' or 'XSS' problems by allowing code to be included in data provided by my users, but I don't want to stop them using ! or @ or $ or % or ( or ) as those would be perfectly valid characters for them to have in for example the title of an Event!
It would be even better if I could actually remove a "disallowed" character from the field, but I can't see how to do that...
If you can change this thread from (Private) to (Public) I would be quite happy with that, in case it might help other Jotform users.
- JotForm SupportabajanAnswered on February 22, 2015 at 06:11 AM
Editing the condition so that !, @, $, %, ( and ) are allowed but left-angled brackets, right-angled brackets and the ampersand-octothorpe combos aren't is quite feasible, as demonstrated in this other version of your form.
When you state that it would be better if the disallowed characters could be removed from the field, do you mean that you would prefer to allow them to be submitted and then have them automatically removed after submission? Please elaborate.
As requested, the thread has been reset to Public. I had set it to Private only because my demo form is a clone of your own which you had not revealed in the opening post.
- JotForm SupportabajanAnswered on February 22, 2015 at 06:26 AM
I just ran a test on this thread and it turns out that it's not fully public. Your replies are public but my replies (the ones tagged with (Private)) aren't. Moreover, the thread is displayed only temporarily before redirecting the viewer to the general forum.
I'll submit a ticket.
- rsvpfreeAnswered on February 22, 2015 at 06:58 AM
Hi again abajan. On second thoughts, "removing a "disallowed" character from the field" would probably have no advantages -- your method of preventing submission by removing the "Submit" button, and leaving the user to edit the field before proceeding, would probably be the best option.
Anyway, this is not a **vital** element of my form at this time; I was just curious as to why AlphaNumeric Validation excluded common punctuation. It would seem to make it fairly useless in many cases!
Hopefully the private/public bug you discovered will soon be fixed. When you say "I'll submit a ticket" is that a private ticket system for Support operatives? I haven't seen mention on the website of a users' ticket system....
- JotForm SupportabajanAnswered on February 22, 2015 at 09:27 AM
Yes, the ticket system is only accessible to JotForm associates. The idea is that our support team would handle whatever queries we can and forward the rest to "Level 2". Each ticket would then be assigned to the most appropriate team member.
What I can do is submit a ticket requesting that the alphanumeric validation be more flexible. Perhaps we could have an extra setting where form creators can specify what characters besides strictly letters and digits are allowed or something like that.
- rsvpfreeAnswered on February 23, 2015 at 02:52 AM
Thanks, abajan. <<Perhaps we could have an extra setting where form creators can specify what characters besides strictly letters and digits are allowed or something like that.>> That's exactly what I was thinking!
- JotForm SupportabajanAnswered on February 23, 2015 at 05:00 AM
No problem. The ticket has been submitted.