validate space character in a form

I setup some fields in a form. They will get the input.

I will do the validation in each field in the form.


 {
                     type: "input",
                     label: "Display Name",
                     name: "FIELD_DISPLAY_NAME",
                      maxLength:30,
                     validate: "ValidAplhaNumeric",
                       offsetLeft : 50,
                     labelWidth: 80,
                     inputWidth: 150
                 },      

I have problem that < validate: “ValidAplhaNumeric” > will check <0-9, a-z and A-Z>.
But it cannot pass a space character. a space character in a input field. e.g.

I want to ask < validate: “ValidAplhaNumeric” > and add one validation for a space character ?

It work ? How about the method ?

Hi

use the following:

{type: “input”, … validate: function(v){ return v.match(/^[a-z0-9\s]*$/gi)!=null; }

Andrei ,

I have get the result for validation in a space character .

But I have other validation question.

For example, I do a validation, have error and alert message. Now it will go to next input field.

But I want to set it that do a validation, have error and alert message. After that it will remain at the error 's input field. That is not goto next input field.

How about this method ?

Best Regards !

Hi

not sure we have exactly what you need, but you can try to combine:

  1. live validation
    dhtmlx.com/docs/products/dht … ation.html

  2. onValidateError event
    dhtmlx.com/docs/products/dht … vents.html

  3. set item focus
    docs.dhtmlx.com/doku.php?id=dhtm … titemfocus

I have studied your example but no I need event.


validate: "ValidAplhaNumeric",

I mean to use the validate of the form and alert the error message. The mouse curser is hope to remain in the error’s field. Now it is to move next field in the form.

please clarify your question

Andrei,

Pls see the attached picture which is the real case.

The main point is that the mouse curser can remain to stay at the error field and not move to next field ?



{type: "input", ... validate: function(v){ return v.match(/^[a-z0-9\s]*$/gi)!=null; }

the code is for validate for space between characters. It is provided by you.

I want to add validate for under score < dd_dd > between characters in the statement ?

How about this ?

improve regexp, [a-z0-9\s_]

cursor moved to next field when you press tab?
but in case of validateError for prev field you want keep it on oprev field?
if yes - use myForm.setItemFocus(id) inside onValidateError callback
if not - please clarify your question more

I can get the result for [a-z0-9\s_] !

Thanks !

On the other hand, I do not press the tab when cursor moved to next field .

And the cursor moved to next field after the onValidateError do action.

The onValidateError have call back function ?

How about your suggestions ?

Hi

validate do not move cursor. cursor moved by user (pressing tab or mouse click), yes, there is onValidateError event which have callback. see second link above