This topic is locked

Javascript

11/17/2010 11:46:25 AM
ASPRunnerPro General questions
L
luic author

Hi,
I added the following code in the load javascript for the edit event to validate the input date of birth field. What ever I put into the field including alpha characters, the message does not show up. Is there something wrong?
The reason why I do this is because the DOB is a date field but we want to enter the date directly instead of using the drop downs for year, month and day. We need to validate the input date field and our format is in dd/mm/yyyy. Please advise.
Thanks.
Chris.
-----

var ctrl = Runner.getControl(pageid, 'DOB');

ctrl.addValidation({

regex: "[0-9]{2}\/[0-9]{2}\/[0-9]{4}",

message: "The field should be a number form 0 to 9",

messagetype: "Text"

});

Sergey Kornilov admin 11/17/2010

Chris,
set 'Edit as' type to 'Text field' and validation will work.

L
luic author 11/17/2010

Thanks. But the issue is that if I change it to text field, how can I get the date picker? Our users want to enter the date or use the date picker. They don't like the dropdown.
The issue is that once we take away the dropdown, we need to ensure the date format for the input is correct like 'dd/mm/yyyy'.
Any idea?
Chris.

Sergey Kornilov admin 11/17/2010

Chris,
unfortunately you cannot add validation to date edit field. I'll see what we can do in this regard.

Sergey Kornilov admin 11/18/2010

Chris,
we'll add this option in the next major update.
You have two options now:

  1. Simple edit box with validation
  2. Edit box with datepciker without validation (you can validate it on the server side for example)

L
luic author 11/20/2010

Thanks, it will be useful in future project. I believe your major release is referring to version 6.3. Unfortunately, I am using 6.2 now, but will see how easy I can upgrade to 6.3.
Chris.

Sergey Kornilov admin 11/21/2010

No, version 6.3 released already. We won't be able to add this till version 7.0.

L
luic author 11/21/2010

Thanks.
In you next major release, can we have the option to assign default value of the search fields on server side or using session variable.
Chris.