On Aug 15, 2008, at 7:33 AM, Dan Shirah wrote:
I apologize for my ignorance, I don't really know much about
javascript. When I add all that into my form page, when I submit the
form, it just replaces the page I was on with the form results, rather
than in the new frame page. I'm assuming I need to put the url for the
frameset page in that code somewhere. Where does it go? And, which
part do I replace with the frame name on that frameset page?
Thank you for taking the time to help me with this, I really
appreciate it!
Let's look at the code:
//var1 and var2 are the search criteria the user entered in your
search form(You may have more or less)
function submitForm(var1,var2) {
//top.leftFrame is how you set the focus to the frame you want.
leftFrame could be different on your system...whatever you named the
frame.
//top.leftFrame.document.my_search.text1.value=var1 assumes the form
name in the frame you want data in is named
//my_search and it givs the text object text1 the value of var1 from
your search form
top.leftFrame.document.my_search.text1.value = var1;
//top.leftFrame.document.my_search.text2.value=var2 assumes the form
name in the frame you want data in is named
//my_search and it givs the text object text1 the value of var2 from
your search form
top.leftFrame.document.my_search.text2.value = var2;
//top.leftFrame.document.my_search.submit() will submit the form in
your target frame then you can use the $_POST values throughout the
frame
top.leftFrame.document.my_search.submit();
//document.search_form.submit() will submit your search page. I use
this so I can reuse the $_POST values to display the search criteria
after submit.
document.search_form.submit();
}
In the <head> of my page, I have this:
<script type="text/javascript">
function submitForm(var1,var2) {
top.mainFrame.document.my_search.text1.value = var1;
top.mainFrame.document.my_search.text2.value = var2;
top.mainFrame.document.my_search.submit();
document.search_form.submit();
}
</script>
Then, for the form code I have this:
<form name="search_form" method="post" action="http://webcat.winnefox.org/web2/tramp2.exe/do_keyword_search/guest
" id="qpl">
<input type="hidden" name="SETTING_KEY" value="Menasha" />
<input type="hidden" name="index" value="default" />
<input TYPE="hidden" NAME="hitlist_screen" VALUE="hitlist.html" />
<input TYPE="hidden" NAME="record_screen" VALUE="Record.html" />
<input type="hidden" name="query_screen" value="home.html" />
<input type="hidden" name="servers" value="1home" />
Find library books, music, movies and more...<input
class="searchbartextfield" id="query" name="query" type="text"> <a
href
=
"javascript:submitForm
(document
.search_form.var1.value,document.search_form.var2.value)">SEARCH</
a> <a id="topNav_advanced_search" href="/sites/
beta.menashalibrary.org/themes/salamander/searchframe.html">Advanced
Search</a>
</form>
If I type in a word in the search box http://beta.menashalibrary.org/about
and hit enter, it searches the catalog just fine, but then just
replaces the current page with the search results. If I click on the
SEARCH link with the javascript, it does nothing.
I want the results to go to this url: http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html
in the frame name of mainFrame. I'm thinking that address needs to go
in the javascript somewhere so it knows where to go, but where? Does
the rest of the code look ok?
Thanks again for taking the time to help me with this.
- jody
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php