February 3, 200421 yr 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 ?
February 3, 200421 yr 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
February 7, 200421 yr 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
February 7, 200421 yr 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
Create an account or sign in to comment