www.webdeveloper.com
Results 1 to 3 of 3

Thread: Submit to other submit page which submits too and load

  1. #1
    Join Date
    Mar 2013
    Posts
    3

    Submit to other submit page which submits too and load

    Is it possible to use javascript to submit from page#1 to another page#2 which submits to the iframe within and then load page#2 with submitted results ?

    Page#1 search form:
    <form id="SearchForm" action="http://mysite/search-results-jobs/" target="" method="post">
    <input type="hidden" name="action" value="search" />
    <input type="hidden" name="listing_type[equal]" value="Job" />
    <label><strong>What?</strong>
    <em>
    <input type="text" value="job title, keywords or company name"
    onblur="if(this.value=='') this.value='job title, keywords or company name'"
    onFocus="if(this.value =='job title, keywords or company name' ) this.value=''" name="keywords [all_words]" />

    </em></label>




    <label><strong class="color">Where?</strong><b><input type="text" value="city, state or zip code"
    onblur="if(this.value=='') this.value='city, state or zip code'" onFocus="if(this.value =='city, state or zip code' ) this.value=''" name="City[all_words]" /></b></label>


    <a href="#" class="SearchForm-link" onclick="document.getElementById('SearchForm').submit()"/>Search</a></form>

    Page#2
    <form id="SearchForm" action="http://mysite/search-results-jobs/" target="my-iframe" method="post">
    <input type="hidden" name="action" value="search" />
    <input type="hidden" name="listing_type[equal]" value="Job" />
    <label><strong>What?</strong>
    <em>
    <input type="text" value="job title, keywords or company name"
    onblur="if(this.value=='') this.value='job title, keywords or company name'"
    onFocus="if(this.value =='job title, keywords or company name' ) this.value=''" name="keywords[all_words]" />

    </em></label>




    <label><strong class="color">Where?</strong><b><input type="text" value="city, state or zip code"
    onblur="if(this.value=='') this.value='city, state or zip code'" onFocus="if(this.value =='city, state or zip code' ) this.value=''" name="City[all_words]" /></b></label>
    <a href="#" class="SearchForm-link" onclick="one(); two(); three(); four();">Search</a>
    <input type="submit" id="btn-search" class="button" value="Cauta"/></form>

    <iframe id="my-iframe" name="my-iframe" align="right" src="http://mysite.com/" frameborder="0" height="100%" scrolling="no" width="100%"></iframe>

  2. #2
    Join Date
    Mar 2013
    Posts
    3
    Any thought?

  3. #3
    Join Date
    Mar 2011
    Posts
    1,136
    You can use JavaScript on Page 2 to accept the form submission data from Page 1 and populate hidden 'input' tags in the form on Page 2. Then the combined data in the form on Page 2 can be sent to the page/document in your <iframe> which will ultimately process everything.

    It can be cumbersome, though, because this would require the <form> on Page 1 to use method="get". That means the user data is encoded into a query string that's added to the URL for Page 2, and there are limitations on the size of query strings (among other issues). But I don't see a problem with your example.

    Search on "javascript prepopulate forms" and you'll find some good advice.
    Rick Trethewey
    Rainbo Design

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles