Focal Point
[SOLVED] Maintain: MDY date validation using javascript

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/432102034

April 28, 2010, 06:12 PM
paulux99
[SOLVED] Maintain: MDY date validation using javascript
I have seen some posts on date validation within html page using javascript but I have not found one that I can use within maintain form. I was wondering if someone had a javascript that checks MDY date (event handler and javascript) is entered correctly within a maintain form
For example, The script will check that date like 20/05/25 is incorrect.


function OnDate_effect_Edit_Blur ( ) {
.......

}

This message has been edited. Last edited by: Kerry,
April 28, 2010, 06:45 PM
Waz
There are validation js libraries that come with WebFOCUS.

For example ibiValidate.js.

You could also create your own. It would be simple.

Take the date, split it up into parts, assuming the delimiter is there, and is / or - or something else.

Test each part for correct ranges.

If you are able to use the ibiValidate script, it will add a calendat option, and it will validate for you.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

April 28, 2010, 07:32 PM
Dan Satchell
I found these posts by doing an advanced search of techsupport.ibi.com for the text "date validation maintain"

These two links describe use of the Maintain validation library.

IBIValidation library
Validation library

There is also this post about an older technique.

Validate date field in Maintain

This message has been edited. Last edited by: Dan Satchell,


WebFOCUS 7.7.05
April 28, 2010, 09:02 PM
paulux99
I was able to use the ibivalidate.js along with MDYY . It seems that the script wants 4 digits year. thanks all!
April 29, 2010, 08:12 AM
Maintain Wizard
Another solution is to use the calender object and not let the user enter the date in by hand. Currently you have to apply three JS files and a CSS file to your form to make the calendar object appear for date fields. In 7.7 we have added the option to the forms / fields property sheet so you can automatically turn the calendar on for all smart date formats, and turn it off for specific ones.

Mark
April 29, 2010, 05:37 PM
Waz
quote:
In 7.7 we have added the option to the forms / fields property


Although I'm not using maintain, Mark thats good news, it'll make so much easier.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!