Results 1 to 3 of 3

Thread: Form on external page

  1. #1
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Form on external page

    1) Script Title: Ajax Tabs Content Script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...axtabscontent/

    3) Describe problem:

    I've got a form on one of my external pages. When i click on the submit button the page reloads. the problem is the page won't load in my container no mater what i try. Is this possible or do i have to change the form?

    what i have now :
    Code:
    <form action='" . $_SERVER['PHP_SELF'] . "' method='post'>
    			  Category: <select name='cat'>
    				<option>All</option>
    				<option>Movies</option>
    				<option>Music</option>
    				<option>Apps</option>
    				<option>Series</option>
    				<option>Other</option>
    			  </select>
    <input type='submit' name='knop' value='Filter'>
    			</form>
    Thank you for taking a look at this.
    Rashnu

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,626
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    When you submit a form using it usually reloads the page completely if the action contains either the current page name or "". It is difficult to submit a form through a submit button without reloading your current page (I mean retaining the state of your current page).

    What you can do is that for submitting the form you can use AJAX instead of using the normal HTTP method. In that case you have to convert the "submit' button into a normal button and attach a JavaScript function with it. The JavaScript function will issue the AJAX call, which would be this page itself and you can handle the success part or failure part of the AJAX processing without much trouble.

    In this idea as your current page is not being reloaded you'll be able to maintain the current state of your page without any issues.

    Hope this helps.

  3. #3
    Join Date
    Sep 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for the quick response.

    Could you give an example perhaps? and do I have to place the button inside the form then?

    Thx,
    Rashnu

Bookmarks

Posting Permissions

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