Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Date Validation Online

Featured Replies

We have been using Javascript to do this. Firstly we created calculated fields which split the date into day, month and year. Then use pop-ups for each; stop mistakes from the users! We then reassemble the date with a Javascript function and write back to the database.

<select>

<script>

for (i=1; i<32; i++)

{

if ("[FMP-Field:dob_day]" == i){document.write('<option value="' +i +'" selected>' +i +'</option>');}

else{document.write('<option value="' +i +'">' +i +'</option>');}

}</script>

</select>

<select>

<script>

for (i=1; i<13; i++)

{

if ("[FMP-Field:dob_mon]" == i){document.write('<option value="' +i +'" selected>' +i +'</option>');}

else{document.write('<option value="' +i +'">' +i +'</option>');}

}</script>

</select>

<select>

<script>

for (i=2001; i>1980; i--)

{

if ("[FMP-Field:dob_year]" == i){document.write('<option value="' +i +'" selected>' +i +'</option>');}

else{document.write('<option value="' +i +'">' +i +'</option>');}

}</script>

</select>

  • Newbies

Hello gurus. I'm new to the FMP realm. I've managed to use Home Page with FMP5 to create a db site, but the date validation doesn't seem to be working. I've specified "Strict Data Type: 4-digit year date", with a message reminding users to use "mm/dd/yyyy" format, and it works perfectly within FileMaker, but when I access it online it does not care what format I use, nor does it display my message. Any suggestions?

Thanks in advance,

-Chris

  • Newbies

Wow. Thanks for responding. You assume my level of knowledge to be greater than it is. smile.gif" border="0 I understand the concept of creating pop-up fields for day, month, and year, but I wouldn't know where in the html I'd need to paste the java script you posted. Is that the same sort of script that I'm using (and not seeing) from Claris Home Page's FMP connection assistant?

I'm also allowing the user to search for records with dates "on or before" etc..., I'm not sure how I'd do that with 3 separate fields for the date. I guess I need to really think about this until it makes sense. Thanks again for your help!

  • Author

Chris,

My previous post is for displaying a date already in the database and then allowing users to change that. However, for the purpose of searching you can still use pop-ups for user input. e.g.

<form name="mySearch" action="FMPro" method="post">

.

<input type="hidden" name="myDate" value="">

Enter Month:<select>

<option value="1">Jan</option>

.

<option value="12">Dec</option>

</select>

.

<input type="hidden" name="-find">

<input type="button" value="Start Search" onclick="checkdate();">

</form>

In the 'head' of the page, between </title> and </head>, have this Javascript function:

<script>

function checkdate() {

with document.mySearch {

myDate.value = elements[a].value + "/" + elements + "/" +elements[c] ;

submit();

}

}

</script>

Replace a,b,c with the number of the element in the form, e.g.:

<form ........>

<input type="hidden" name="-db" value="myDB.fp5">

<input type .....

The -db input tag is elements[0] with the next input tag being elements[1] and so on.

Hope this helps.

Garry

p.s. Other ways may exist to force a date.

  • 2 weeks later...
  • Newbies

Thanks again, Garry. I guess now what I need to know is how to assemble the three month/day/year fields into one field that can be compared to others. For example, for an online homework system, a teacher has entered the "date due" using three separate date fields. A student can search for assignments due on, before or after a certain date. Currently that process is simple because the date is just one field, and It can search for that one field and return matches. How can I search for dates "before or after" a specified date if the date is composed of separate fields? (I like your suggestion of using separate fields because it would be much simpler for the user if the date was all pop-ups).

Hi, I have something like this running for an order form's 'due date' the input is:

<SELECT NAME='Day'> [FMP-OPTION: Day, LIST=Day] </SELECT><SELECT NAME='Month'> [FMP-OPTION: Month, LIST=Month] </SELECT><SELECT NAME='Year'> [FMP-OPTION: Year, LIST=Year] </SELECT>

and I then assemble the three in a calculation field in the database as a date so it's searchable.

Another method is to use a neat little Java calendar to choose the date, which then pastes it into the field - this is good for 'second Wednesday in August' without looking up the calendar date. Mail me if you want a copy.

Jeff

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.