Mattias R Posted June 3, 2003 Posted June 3, 2003 Hi! My startpage have one field (date)that I search the db. If I find at least on record I can pass the value to the next page and I
Unable Posted June 3, 2003 Posted June 3, 2003 Have you tried using [FMP-CurrentFind], and the related tags? Please refer to your CDMLRD.
Mattias R Posted June 3, 2003 Author Posted June 3, 2003 Yes, I have tried [FMP-CurrentFind]. I doesn
Unable Posted June 3, 2003 Posted June 3, 2003 Ok, that was just a guess and you hadn't said you'd tried it. No, a token won't work because you will be unable to set it. JavaScript may be your only hope. And that should prove tricky.
Leb i Sol Posted June 3, 2003 Posted June 3, 2003 You can use some JS to set the token.X = to form element X <script> function TOKEN_PASS() { document.FORM_name.elements["-token.X"].value = document.FORM_name.elements[X].value; document.FORM_name.submit(); }; </script> JS credits: Garry However, I don't know if the token will get passed to an -error page...it "should" but I have not tested it. I hope it helps
Mattias R Posted June 3, 2003 Author Posted June 3, 2003 My startpage look like this with the JS: ... <form method="post" action="FMPro"> <input type="hidden" name="-db" value="booking.fp5"> <input type="hidden" name="-lay" value="in"> <input type="hidden" name="-format value="search_show_day.htm"> </tr> <tr> <td></td> <td>yyyy-mm-dd</td> <td></td> </tr> </table> <input type="hidden" name="-error" value="search_error.htm"> <input type="hidden" name="-SortField" value="computer"> <input type="hidden" name="-SortOrder" value="Ascending"> <input type="hidden" name="-SortField" value="time"> <input type="hidden" name="-SortOrder" value="Ascending"> <input type="hidden" name="-op" value="eq"> <input type="hidden" name="-Find"> <input type="hidden" name="-Token" value="[FMP-Field: date]"> <script> function TOKEN_PASS() { document.FORM_name.elements["-Token"].value = document.FORM_name.elements[x].value; document.FORM_name.submit(); }; </script> <td width="34%"><div align="right"><strong>Date:</strong></div></td> <td width="31%"> <input name="date" type="text" size="15"> </td> <td width="35%"><input type="submit" name="-Find" value="Search"></td> </form> ... And my error-page look like this: ... <input name="date" type="text" value="[FMP-CurrentToken]"> ... And it returns [FMP-Field: date] in the input field.
Leb i Sol Posted June 3, 2003 Posted June 3, 2003 I don't think you understood me correctly "document.FORM_name.elements[x].value;" is a general format...you have to count how many elements you have in the form...text fields or drop lists OR Hidden fields are counted as 1 each. so if your text field is 3rd in the form it would be document.FORM_name.elements[3].value; also your form has to have a name "FORM_name" is a general format. so: <form action="FMPro" method="post" name="FORM_name" > also the <script> should go above HEAD tag in HTML and then called with submition. sooooo <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Token Set to the Nth Element of a Form</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script> function TOKEN_PASS() { document.FORM_name.elements["-Token"].value = document.FORM_name.elements[8].value; document.FORM_name.submit(); }; </script> </head> <body> <form action="FMPro" method="post" name="FORM_name" onSubmit="TOKEN_PASS();"> <input type="hidden" name="-db" value="booking.fp5"> <!-- 1st element --> <input type="hidden" name="-lay" value="in"><!-- 2nd element --> <input type="hidden" name="-format" value="search_show_day.htm"><!-- 3rd element --> <input type="hidden" name="-error" value="search_error.htm"><!-- 4th element --> <input type="hidden" name="-SortField" value="computer"><!-- 5th element --> <input type="hidden" name="-SortOrder" value="Ascending"><!-- 6th element --> <input type="hidden" name="-op" value="eq"><!-- 7th element --> <input name="date" type="text" id="date"><!-- YOUR NUMBER 8 element --> <input name="Submit" type="submit" value="Submit"> <input type="reset" name="reset" value="Reset"> </form> </body> </html> also I would look into CDML reference for "-Token" now go get lucky
Mattias R Posted June 4, 2003 Author Posted June 4, 2003 ok. Thanks! Javascript is not my cup of tea...
Recommended Posts
This topic is 7944 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 accountSign in
Already have an account? Sign in here.
Sign In Now