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

Question

Question

multi-line number input validation

asked on December 15, 2015 Show version history

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 ?

0 0

Answers

APPROVED ANSWER
replied on December 16, 2015

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.

0 0
SELECTED ANSWER
replied on December 21, 2015

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.

1 0
SELECTED ANSWER
replied on December 21, 2015

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.

1 0

Replies

replied on December 15, 2015

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?

0 0
replied on December 16, 2015

Hi Chris,

I mean multi-value integer fields as defined in Laserfiche Administration Console:

Stéphane

0 0
replied on May 31, 2016

You can add the date field inside a collection or table, then you can add multiple values for it.

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

Sign in to reply to this post.