The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add a textbox validation rule via the Custom Fields module interface

A newbie question:

I am trying to find a way to check the content of various textbox fiels on my form so as to ensure that they contain a number. If the number has decimal digits, those should be separated by a dot (not by a comma that often people use).

For that, I am trying to use the Custom Fields module. I have created a new field type ("test"), based on the Textbox field type. I would like to add a validation rule that would use a regular expression for the validation of the textbox, which in my case would be "/^\d*\.{0,1}\d*\z/".

I assume that, for an external form I would use something like
rules.push("reg_exp,field_name,'/^\d*\.{0,1}\d*\z/',Error message");
However, how could I do that using the interface of the Custom Fields module? The form that I plan to use this validation on is an internal one.

Thanks in advance for your help!

In the mean time, I have managed to go around the problem. I have used a Hooks rule for "ft_create_blank_submission, end" and an identical one for "ft_update_sumbission, end", which goes through the $_POST fields that should have numbers, checks that the strings have number values, changes the commas to dots and then updates the content of the fieds prior to submission.
However, changing the user input in that way, is something that I would like to avoid.
An archive of the new model is approved for the bloggers. Post of this kind and bestessays is advanced for the promotion for the archives. Element is filed for the top of the science for all goals for the newly adopted items for the future times.

Forum Jump:

Users browsing this thread: 1 Guest(s)