Jump to content

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

Recommended Posts

Posted

I have a file that has the date formatted dd/mm/yyyy, but I want the user to be able to enter the date mm/dd/yyyy from the web form. ( I tried changing the database to use system formats but it gave an 500 error when I tried submitting data from the web form this way). Got any ideas how to do this ?

Posted

Hi, date formats on the web can be a pain. I'd use two fields:

The input field which would be a text field and would have a JavaScript validation to make sure that it's really input mm,dd,yyyy and then I'd do a calculation text-to-date field in the database to swop it around, maybe like this:

TextToDate(Middle(thedate_input,4,2)

&"/"

&Left(thedate_input,2)

&"/"

&Right(thedate_input,4))

on second thoughts, just do the same thing within the HTML page with JavaScript into a hidden field and use that for input!

regards, jeff

Posted

You can do this with Javascript on the page before the Form is Submitted. For example:


<html><head>

<script>

function moddate()

   {

   formdate = document.myform.mydate.value.split("/");

   document.myform.mydate.value = formdate[1] + "/" + formdate[0] + "/" + formdate[2];

   return true;

   }

</script>

</head>

<body><form name="myform" action="FMPro" method="POST" onsubmit="moddate();">

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

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

Enter Date (mm/dd/yyyy): <input type="text" name="mydate" value="">

<input type="submit" name="-new" value="Submit Form">

</form></body></html>

Hope this helps.

Garry

Posted

Hi, army! I've been away from the FM world for months so I'm a little rusty, but I think I remember something about some formats being related to the layout being used. Maybe you can use a different layout for web input? I have not checked this at all, but I just thought I'd mention it if you haven't tried it yet.

Good luck!

--ST

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