ErnieG Posted April 18, 2003 Share Posted April 18, 2003 I'm a couple of weeks into HTML and CDML, with a search page and two different forms for viewing found records (by page and by list). Is there a way to place TWO "submit" buttons on the search page, one for each of the format files? It appears that the search fields have to be WITHIN the <FORM ACTION> and </FORM> tags, and when I try placing a second <FORM ACTION> . . . </FORM> combination in the file, that button doesn't work. I can always place two links on the home page to two different search pages, one for each format file. But I was hoping there was a more elegant solution . . . or that I was just missing something very, very basic. Thank you for your time. Ernie Link to comment Share on other sites More sharing options...
Unable Posted April 18, 2003 Share Posted April 18, 2003 "...when I try placing a second <FORM ACTION> . . . </FORM> combination in the file, that button doesn't work." Post the code you have. Link to comment Share on other sites More sharing options...
Anatoli Posted April 18, 2003 Share Posted April 18, 2003 On my search page are 5 submit/search buttons. No problem. There is not even theoretical limit on this number. You need just properly formatted FORM..... /FORM HTML elements. HTH Link to comment Share on other sites More sharing options...
Garry Claridge Posted April 19, 2003 Share Posted April 19, 2003 You could even use Javascript to replace the value of the "-format" tag, e.g.: document.myform.elements["-format"].value = "myformatfile.html"; Good Luck. Garry Link to comment Share on other sites More sharing options...
Anatoli Posted April 19, 2003 Share Posted April 19, 2003 Yeah, what Garry is suggesting will work even with single FORM and multiple Submit buttons. Link to comment Share on other sites More sharing options...
ErnieG Posted April 19, 2003 Author Share Posted April 19, 2003 Sorry, Garry, I was hoping to avoid javascript until I had a better grasp of the basics. As much as I appreciate your hint, I don't begin to understand where that piece would go or how it would be called. Here's my code (right out of the CDML reference tool) in case there's something simpler: <FORM ACTION="FMPro" METHOD="post"> <INPUT TYPE="hidden" NAME="-db" VALUE="CHS-IQM_database.fm"> (All of the searchable fields are here, then) <INPUT TYPE="hidden" NAME="-format" VALUE="detail.html"> <input type="hidden" name="-Max" value="1"> <INPUT TYPE="submit" NAME="-find" VALUE="Post search results as editable page"> <INPUT TYPE="reset" VALUE="Clear Form to start over"></form> This takes me to a found set viewed by page. For the list view, if I had a second ENTIRE set of codes below . . . <FORM ACTION="FMPro" METHOD="post"> <INPUT TYPE="hidden" NAME="-db" VALUE="CHS-IQM_database.fm"> <input type="hidden" name="-Format" value="report.html"> <input type="hidden" name="-Max" value="all"> <input type="submit" name="-Find" value="Post search results in report form"></form> . . . pressing that button simply returns ALL records, apparently ignoring the searchable fields. So I'm really missing something here. If I try to "nest just the last two lines within the larger <FORM> </FORM>, then both buttons perform the same way. Can you see what I'm doing wrong, Anatoli or "Unable"? Or is it time to learn Javascript? From someone REALLY unable! Thanks again. Ernie Link to comment Share on other sites More sharing options...
Anatoli Posted April 19, 2003 Share Posted April 19, 2003 Forms cannot be nested. If you want to go this way your options are: 2 complete forms or JavaScript or Lasso HTH Link to comment Share on other sites More sharing options...
Garry Claridge Posted April 20, 2003 Share Posted April 20, 2003 <form name="myform" action="FMPro" method="post"> <INPUT TYPE="hidden" NAME="-db" VALUE="CHS-IQM_database.fm"> (All of the searchable fields are here, then) <INPUT TYPE="hidden" NAME="-format" VALUE=""> <input type="hidden" name="-Max" value=""> <inpuy type="hidden" name="-find"> </form> <tr><td>[FMP-Field:results]</td><td><a href="#" onclick="subedit('[FMP-Field:results]');">Edit</a></td><td><a href="#" onclick="subreport('[FMP-Field:results]');">Report</a></td></tr> The Javascript in the <head> of the page may look like this: <script> function subedit() { document.myform.elements["-format"].value = "detail.htm"; document.myform.elements["-max"].value = 1; document.myform.submit(); }; function subreport() { document.myform.elements["-format"].value = "reports.htm"; document.myform.elements["-max"].value = "All"; document.myform.submit(); }; </script> This is an example of how Javascript could be used with a single form. Good Luck. Garry p.s. So we can better understand the situation you could post more of your code, as I don't fully grasp what, and how. Link to comment Share on other sites More sharing options...
ErnieG Posted April 20, 2003 Author Share Posted April 20, 2003 I tried your coding, Garry, but I probably missed something so simple you couldn't imagine anyone not knowing. Like the [FMP-Field:results] for example: Did I need to replace that with something? Or replace the # symbol in HREF? Did I need to add <script><-script> in the body (which made the links disappear) or Language="JavaScript" to the tag? Etc. The first thing in by Body is: _______________________________________ <FORM ACTION="FMPro" METHOD="post"> <INPUT TYPE="hidden" NAME="-db" VALUE="CHS-IQM_database.fm"> _______________________________________ Then there are 11 fields for users to restrict the search. Some are based on value lists: _______________________________________ <b>THEME</b> <select name ="themetitle">[FMP-Option: themetitle, list=WEBThemeTitle]</select> _______________________________________ (I put a hard return at the top of the value list so the field stays empty if nothing is chosen.) Some are simple entries: _______________________________________ <B>OBJECT TITLE</B> <input type="hidden" name="-op" value="Contains"><INPUT TYPE="text" NAME="Objecttitle" VALUE="" SIZE=40> Or: <B>CHS REF. NUMBER</B> <input type="text" size=14 name="CHSRefNo"> _______________________________________ Just before the </body> are the concluding elements of the FORM tag: _______________________________________ <INPUT TYPE="hidden" NAME="-format" VALUE="detail.html"> <input type="hidden" name="-Max" value="1"> <INPUT TYPE="submit" NAME="-find" VALUE="Perform Search"> <INPUT TYPE="reset" VALUE="Clear Form to start over"></form> _______________________________________ The second link or button would post to a format file in list form. This is the code in my other search page: _______________________________________ <FORM ACTION="FMPro" METHOD="post"> <INPUT TYPE="hidden" NAME="-db" VALUE="CHS-IQM_database.fm"> <input type="hidden" name="-Format" value="report.html"> <input type="hidden" name="-Max" value="all"> <input type="submit" name="-Find" value="Post search results in report form"> <INPUT TYPE="reset" VALUE="Clear Form to start over"></form> _______________________________________ If this leads to a simple suggestion, Garry, I'll be grateful. Otherwise I'll be content with two search forms until I tackle JS, which I know will be extremely useful. I have a glimmer of its syntax now, and I noted your recomendation of a book in an earlier response to someone else. Thanks again. Ernie Link to comment Share on other sites More sharing options...
ErnieG Posted April 23, 2003 Author Share Posted April 23, 2003 Garry, On the off-chance you look at this again, I guess I'd really like to get one JavaScript going. Your posted example is quite straightforward, except that nothing happens when I click the links that appear. I think it almost has to be the [FMP-Field:results] in the HREF line (which I assume is placed after </form>), since I can see the pattern of everything else. Was I in fact supposed to replace [FMP-Field:results] with the search fields, or what? Hope I'm not so impossibly muddled as to be unhelpable. Thanks. Ernie Link to comment Share on other sites More sharing options...
Garry Claridge Posted April 23, 2003 Share Posted April 23, 2003 My coding is a very "loose" example. The [FMP-Field:results] is just a place holder for whatever you wish to place there. ("[FMP-Field:xxxx]" needs to be a field on the Layout stated in the database request.) After reading some more of your page, and gaining a better understanding of what you are attempting to achieve (I think), this would be how to call the Javascript: <tr> <td><a href="#" onclick="subedit();">Show Details</a></td> <td><a href="#" onclick="subreport();">Show Listing</a></td> </tr> The aim is to have only one Form. Alternatively, you could have two forms and the Javascript could be used to "submit" whichever one is selected. The one Form method just replaces the "Format" file and the "Action", then "submits". You will also need to give your Form a name. The example uses "myform". Good Luck. Garry Link to comment Share on other sites More sharing options...
Garry Claridge Posted April 23, 2003 Share Posted April 23, 2003 Ernie, My email to you was bounced "access denied"! However here are the details. Just try a couple of simple changes first. If they don't work I can rewrite the page. Change this: <input type="hidden" name="-Format" value=""> <input type="hidden" name="-Max" value=""> to this: <input type="hidden" name="-format" value=""> <input type="hidden" name="-max" value=""> These things are case sensitive. I've tested the changes and the functions are now being called. All the best. Garry Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 7839 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