Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 8507 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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
Posted

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
Posted

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!

Posted

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
Posted

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).

Posted

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

This topic is 8507 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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