Re: Passing variable to a page in a frameset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Aug 15, 2008, at 11:32 AM, Dan Shirah wrote:

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>

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.


It looks like you haven't adapted the example I gave you to conform to your page/form structure.

top.mainFrame.document.my_search.text1.value = var1;

The frame you are populating may not be named mainFrame
The form in your destination frame may not be named my_search
The input in you destination frame may not be text1

You have to modify these areas to suit your application and add or remove more as needed.

So, I had this all wrong before. Basically, I need two forms, right? One on my originating page, and one on the page within the frameset I want to pass the values to. Correct?

My form, which I named my_search has one input field, which I named query. In the javascript, I put in this:

<script type="text/javascript">
function submitForm(var1,var2) {
 top.mainFrame.document.my_search.query.value = var1;
 top.mainFrame.document.my_search.submit();
 document.search_form.submit();
}
</script>

In the framset named mainFrame, I have a page which matches the form on the originating page.

Am I on the right track? When I click on the search link, nothing happens.

- jody

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux