Since regular expressions do not apply to multi-line fields in Forms, is it possible to (how to) use Javascript validation so the values can be used to initialize multi-value integer fields ?
Question
Question
multi-line number input validation
Answers
In your form, give the multi-line field a CSS class name like numbers. Then you can use this JavaScript
$(document).ready(function () { $('.numbers textarea').keyup(function() { var invalidChars = /[^0-9\n\r]/gi if (invalidChars.test($(this).val())) { $(this).val($(this).val().replace(invalidChars,"")); } }); });
The field will only accept numbers and line breaks. Then you can use Workflow and pattern matching to return the values as a multi-value token to then be used with your multi-value integer field.
Works great!
Is there any plan to extend repository multi-values into Forms ? For instance inputting a multi-value date field in Forms actually represents a challenge (validation-wise) and I don't understand why there is no provision...
Thanks again Alexander.
Works great!
Is there any plan to extend repository multi-values into Forms ? For instance inputting a multi-value date field in Forms actually represents a challenge (validation-wise) and I don't understand why there is no provision...
Thanks again Alexander.
Replies
Yes it is. There are a few ways to go about this, but the cleanest way I have found is to put your validation method ahead of Forms's validation method. This post outlines just how to do that. Then in your validation method, you can then choose to use regex to validate the multi-line field. Could you explain in a little more detail what you mean by multi-value integer fields?