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

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

Recommended Posts

Posted

Hi all -- I have a script (thanks Garry!) that calculates today's date and formats it MM/DD/YYYY. I have placed it after <HEAD>:

<script>

Today = new Date();

var sTodayDate = (Today.getMonth() + 1) + "/" + Today.getDate() + "/" + Today.getFullYear();

</script>

I want to use the variable "sTodayDate" in performing searches so that outdated records are not pulled. For instance:

<form method=post action="FMPro"

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

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

<input type=hidden name="-format" value="onthecalendar.html">

<input type=hidden name="-op" value="gte">

<input type=hidden name="End Date" value="sTodayDate">

<input type=hidden name="-op" value="cn">

<p class="style26"><span class="style22">Search By Event Name:

<input type="text" name="Event Name">

<input type=hidden name="-max" value="10">

<input type=hidden name="-sortfield" value="Start Date">

<input type=hidden name="-sortorder" value="ascend">

<input type="submit" name="-find" value="Find Events">

<input type=hidden name="-error" value="noresultsfound.html">

</span></p>

</form>

In this piece of code, however, the inclusion of the variable "sTodayDate" does not work. The code works fine if I manually substitute "11/19/2004".

How do I plug in the variable so this works? Thanks, friends.

Posted

Rob,

A couple of methods exist to do this. One is to insert the value, via Javascript, when the Form is submitted. The second is to insert the while the page is being loaded.

Here is the "insertion while loading" method:

<form method=post action="FMPro"

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

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

<input type=hidden name="-format" value="onthecalendar.html">

<input type=hidden name="-op" value="gte">

<script>

Today = new Date();

var sTodayDate = (Today.getMonth() + 1) + "/" + Today.getDate() + "/" + Today.getFullYear();

document.write('<input type=hidden name="End Date" value="' + sTodayDate + '">');

</script>

<input type=hidden name="-op" value="cn">

<p class="style26"><span class="style22">Search By Event Name:

<input type="text" name="Event Name">

<input type=hidden name="-max" value="10">

<input type=hidden name="-sortfield" value="Start Date">

<input type=hidden name="-sortorder" value="ascend">

<input type="submit" name="-find" value="Find Events">

<input type=hidden name="-error" value="noresultsfound.html">

</span></p>

</form>

Good Luck.

Garry

This topic is 7300 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.