Results 1 to 3 of 3

Thread: Simple Form Submission How?

  1. #1
    Join Date
    Aug 2007
    Location
    Kirkland Washington State
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Simple Form Submission How?

    1) Script Title: Basic Ajax Routine

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

    3) Describe problem:

    Hi,

    I'm trying to get this simple form below to submit via the post method so the response loads in the div shown without a page refresh. The form works just fine on it's own but it doesn't seem to be interacting properly with the script because it's not doing what it's supposed to do; no errors, just doesn't load the response in the div named postresult.

    I've searched for a straightforward example of posting a simple form via this script and have the result in a div but cannot find any examples.

    It seems that my skills aren't good enough to figure this out by myself so I'm posting here in the hope that someone can point out what I'm doing wrong.

    I have the script properly installed and the page pointed to it.

    Thanks!



    <div id="postresult">

    <form id='contact_form' method="post" action="http://website.com/index.php" onsubmit="var poststr=createpoststring(); ajaxpack.postAjaxRequest('http://isawyou.com/view', poststr, processGetPost, 'txt'); return false" >

    <div class='hiddenFields'>
    <input type="hidden" name="XID" value="1285be6b71dbf6bd731019230c60a95837ba219b" />
    <input type="hidden" name="ACT" value="20" />
    <input type="hidden" name="RET" value="" />
    <input type="hidden" name="URI" value="/message/tab_connect/1438/" />
    <input type="hidden" name="recipients" value="cGV0ZXJAaXNhd3lvdS5jb20=" />
    <input type="hidden" name="user_recipients" value="n" />
    <input type="hidden" name="charset" value="utf-8" />
    <input type="hidden" name="redirect" value="" />
    <input type="hidden" name="replyto" value="" />
    <input type="hidden" name="site_id" value="1" />
    </div>

    <p><strong>Your email:</strong><br />
    <input type="text" id="from" name="from" size="40" maxlength="35" value="me@domain.com" /></p>

    <p><strong>Email Subject:</strong><br />
    <input type="text" id="subject" name="subject" size="40" maxlength="35" value="" /></p>

    <p><strong>Message:</strong><br />
    <textarea id="message" name="message" rows="5" cols="40"></textarea></p>

    <p><input type="text" class="textinput_full" name="captcha" value="" maxlength="24" /><br />
    <span class="txt_1">Enter the word/letters you see in the image above (cASe insensITiVe)</span></p>

    <p><input type="submit" name="submitButtonName" value="Send" /></p>
    </div>

    </form>


    </div><!-- POST RESULT -->


    <script type="text/javascript">

    function processGetPost(){
    var myajax=ajaxpack.ajaxobj
    var myfiletype=ajaxpack.filetype
    if (myajax.readyState == 4){ //if request of file completed
    if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
    if (myfiletype=="txt")
    document.getElementById("postresult").innerHTML=myajax.responseText
    }
    else
    alert("The following error has occured "+myajax.responseText)
    }
    }

    </script>

    Last edited by Varen; 01-05-2009 at 08:45 PM. Reason: Clarification

  2. #2
    Join Date
    Aug 2007
    Location
    Kirkland Washington State
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool Any input appreciated...

    I'm completely puzzeled as to why I can't get the code in my previous post to work. I'd appreciate ANY suggestions or input!!!

    Thanks!

  3. #3
    Join Date
    Aug 2007
    Location
    Kirkland Washington State
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I must have bad breath.

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
  •