- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 07:13 AM
Would it be best to create a String field and somehow put restrictions on that? If so, what type of restrictions would I apply?
Or is there a way to use the existing Date field to do this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 08:54 AM
var reg = /(19[6789]\d|20[01]\d)/ ;
var ans = g_form.getValue('fieldname');
if(!reg.test(ans))
{
alert('Please enter valid year');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 08:54 AM
var reg = /(19[6789]\d|20[01]\d)/ ;
var ans = g_form.getValue('fieldname');
if(!reg.test(ans))
{
alert('Please enter valid year');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 07:33 AM
I guess some validations should be used in client script to do this...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 07:39 AM
Hi Tess,
There are a couple of options depending on your specific requirements. I'll summarize here and if you need help with a specific one, let me know and I'll try to help out further.
- Choice List:
- Advantage- No data validation is needed, works like a string field in scripts
- Disadvantage- Could be difficult if there is not an upper/lower limit on year choices or a temporary artificial one that can be created
- String:
- Advantage- The year 3000 is easy to accommodate without a really long choice list or maintenance of the list
- Disadvantage- Requires a minimum of a client script or ui policy to ensure the year is a number and potentially other validation
- Integer:
- Advantage- Letters already can not be entered into an integer field so no need to validate that, scalable like the string field
- Disadvantage- May still require other client scripts / ui policies for validation (does the year -43625 sound reasonable/valid?). Also includes a "," or "." separator that I am not certain if it can be removed on a field by field basis (I never tried before).
I hope this helps.
Kind regards,
Travis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 07:59 AM
Hi Tess,
I think easises and least effort will be this way
Use a normal date time field and write an onchange script, on the script read the year selected and if its anything except 1997 then clear the field and throw an alert.
You can make it more generic by using a property and reading the year value from the property(comma separated)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2014 09:59 AM
Thanks everyone for your input! This is now working; thanks again.