rivet Posted September 17, 2003 Posted September 17, 2003 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.
Anatoli Posted September 17, 2003 Posted September 17, 2003 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]
Garry Claridge Posted September 17, 2003 Posted September 17, 2003 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
rivet Posted September 29, 2003 Author Posted September 29, 2003 This looks like it will do it but I get '[object INPUT]' as a result. Any ideas?
Garry Claridge Posted September 29, 2003 Posted September 29, 2003 I don't know what '[object INPUT]' is! Did you leave a ".value" from the assignment? Show us your code. All the best. Garry
rivet Posted September 30, 2003 Author Posted September 30, 2003 Here is the code ------------------ <script> function addtoken() { document.eyeSearch.elements["-token"].value = document.eyeSearch.i_keywords ; document.eyeSearch.submit(); } </script>
Garry Claridge Posted October 1, 2003 Posted October 1, 2003 Yes you did leave ".value" off the assignment. Should be: document.eyeSearch.elements["-token"].value = document.eyeSearch.i_keywords.value ; All the best. Garry
rivet Posted October 2, 2003 Author Posted October 2, 2003 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>
Garry Claridge Posted October 2, 2003 Posted October 2, 2003 Yes, that should work. All the best. Garry
ruadork Posted December 22, 2003 Posted December 22, 2003 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!
Garry Claridge Posted December 23, 2003 Posted December 23, 2003 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
ruadork Posted December 24, 2003 Posted December 24, 2003 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.
ruadork Posted December 24, 2003 Posted December 24, 2003 I did notice that I had <form name"myform" so I changed it to <form name="myform" Unfortunately that did not solve the problem.
ruadork Posted December 29, 2003 Posted December 29, 2003 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.
Recommended Posts
This topic is 7704 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