September 17, 200322 yr is there are way to set the search criteria of one field to a token at time of submission. 1. I would like to state after the results are displayed that 'xx records have been found for the search for ( token) - I know there it the FMP-CurrentFind, but that list all value hidden and other which is not import for the user to see. NOTE!! I am sure I could capture the resulting field as it returns in the format file, but in this case the field being requests is keywords, so the result is not a single words. 2. I would like as a token as well so I can send it back to the DB to log the search words.
September 17, 200322 yr From CDML db: [FMP-FindValueItem] What it does [FMP-FindValueItem] is replaced with the value that was part of the find request that created this page. [FMP-FindValueItem] must be placed between the [FMP-CurrentFind] and [FMP-CurrentFind] tags. Syntax [FMP-FindValueItem: Encoding ] Parameter(s) First parameter (optional): Encoding. Use one of the following reserved words: Raw - Don't perform any encoding URL - Perform URL encoding HTML - (default) Perform HTML encoding Syntax example(s) Return the current find criteria using an HTML file Current find request is:<br> [FMP-CurrentFind] Field: [FMP-FindFieldItem], Op: [FMP-FindOpItem], Value: [FMP-FindValueItem]<br> [/FMP-CurrentFind] <!-- After processing it could look like: Current find request is: Field: First Name, Op: begins with, Value: Joe Field: Last Name, Op: equals, Value: Doe --> Other tags that are required [FMP-CurrentFind], [/FMP-CurrentFind] See also [FMP-FindFieldItem], [FMP-FindOpItem]
September 17, 200322 yr You can use some Javascript to do this. For example: <script> function addtoken() { document.myform.elements["-token"].value = document.myform.myfield.value ; document.myform.submit(); } </script> </head> <body> <form name="myform" action="FMPro" method="POST" onsubmit="Javascript:addtoken(); return false;"> <input type="hidden" name="-db" value...... ..... <input type="hidden" name="-token" value=""> Enter Data: <input type="text" name="myfield" value=""> ....... The Javascript function makes the value of the token equal to the value of "myfield". Then it submits the Form. Hope this helps. Garry
September 29, 200322 yr Author This looks like it will do it but I get '[object INPUT]' as a result. Any ideas?
September 29, 200322 yr I don't know what '[object INPUT]' is! Did you leave a ".value" from the assignment? Show us your code. All the best. Garry
September 30, 200322 yr Author Here is the code ------------------ <script> function addtoken() { document.eyeSearch.elements["-token"].value = document.eyeSearch.i_keywords ; document.eyeSearch.submit(); } </script>
October 1, 200322 yr Yes you did leave ".value" off the assignment. Should be: document.eyeSearch.elements["-token"].value = document.eyeSearch.i_keywords.value ; All the best. Garry
October 2, 200322 yr Author Perfect thanks. One last question, does the following script make sense if I want to handle to values? <script> function addtoken() { document.eyeSearch.elements["-token"].value = document. eyeSearch.i_keywords.value ; document. eyeSearch.elements["-token.1"].value = document. eyeSearch.i_Artist.value ; document. eyeSearch.submit(); } </script>
December 22, 200322 yr The answer above is exactly what I need, but mine isn't working. Could it be because I'm using an include file? I put the <script> info in the main page, but the OnSubmit info in the include file. Here is my code that is not working: In the main file: <link href="style.css" rel="stylesheet" type="text/css"> <script> function addtoken() { document.myform.elements["-token.0"].value = document.myform.month.value ; document.myform.elements["-token.1"].value = document.myform.year.value ; document.myform.submit(); } </script> </HEAD> In the include file: <form name"myform" action="FMPro" method="Post" onsubmit="Javascript:addtoken(); return false;"> <INPUT TYPE="hidden" NAME="-DB" VALUE="calendarmonth.fp5"> etc... <input type="hidden" name="-token.0" value=""><select name ="Month"> <option value="1">January</option> <option value="2">February</option> </select> <input type="hidden" name="-token.1" value=""><select name ="Year">[FMP-Option: Year, List=Years]</select> <input type="submit" name="-find" value="View Month"> My knowledge of JS is limited to copying/pasting code like this, so thanks for your help!
December 23, 200322 yr To tell if the "include" is working you can view the "Page Source" in the browser. From this you will be able to see if the FM data, i.e. Years, has been entered and the other html is present. What do you mean by "not working"? What happens? Good Luck. Garry
December 24, 200322 yr The include is working. I can see that the FileMaker elements are being filled in. By "not working," I mean that when I hit the Submit button, the values for Month and Year are not being set as tokens. I have Current Token:0: [fmp-CurrentToken:0] Current Token:1: [fmp-CurrentToken:1] on the Format page, and they are blank after I press the submit button. So I'm guessing there's something wrong with my code. I am currently avoiding the main/include issue by having all of the js code on the same page, and I still can't pass the tokens from the submit button.
December 24, 200322 yr I did notice that I had <form name"myform" so I changed it to <form name="myform" Unfortunately that did not solve the problem.
December 29, 200322 yr I changed two things, and now it is working: 1. Case sensitive. I had "Years" in one place, but "years" in another. Now I have "years" for both. 2. Hard-coded the <options> instead of using a FMP value list.
Create an account or sign in to comment