SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot naynay99's Avatar
    Join Date
    Jan 2010
    Location
    Los Angeles
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    specifing page (inside div) using submit button

    Hi,

    http://organichs.com/ohsNew/

    I have a form on my contact page. when the user fills out the info and clicks on my submit button, I need that page (send_form_email.php)to load inside my div.

    this is what I have now -
    Code:
     <input type="submit" value="Submit" /></td>
    I have tried this but it doesn't work, I get a blank page.

    <INPUT TYPE="button" onClick="javascript:ajaxpage('send_form_email.php', 'mainContent');">

    any help would be appreciated!
    Last edited by naynay99; Feb 25, 2010 at 12:04. Reason: added more info to subject

  2. #2
    SitePoint Evangelist TommiChi's Avatar
    Join Date
    Oct 2008
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Using <input type="submit"> will load the php page in your current window, so the problem would be with your php file.

    If you want to load content into a DIV, then you would have to make an httprequest to the php file. In the php file you would have to ECHO whatever content you want displayed. All you need to do then is place your httprequest responsetext in the innerhtml of the target div....

  3. #3
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,233
    Mentioned
    47 Post(s)
    Tagged
    1 Thread(s)
    Kinda not-on-topic, but a separate external javascript file using submit() will keep your keyboarding users from getting frustrated trying to submit your form (why? 'cause they and many others hit ENTER to send a form, and not necessarily with the focus on the submit button first either (meaning, people don't always hit TAB after the last input before hitting ENTER)).

  4. #4
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Good call Stomme poes, use the forms submit event.

  5. #5
    om nom nom nom Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,233
    Mentioned
    47 Post(s)
    Tagged
    1 Thread(s)
    been readin' chris heilmann 'bout 'cessabillty... that and i tend to keyboard thru forms anywayz

  6. #6
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Me too. I hate having to use the mouse to click a silly submit button when I can just hit the enter key. It's disappointing how many websites fail to account for this, and have broken forms.

  7. #7
    SitePoint Zealot naynay99's Avatar
    Join Date
    Jan 2010
    Location
    Los Angeles
    Posts
    173
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies. I will try them and report back. Instinctively, I always hit enter as well, then when that doesn't work, I press the button.


Tags for this Thread

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
  •