Results 1 to 10 of 10
  1. #1
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default [Scriptaculous] Any1 know whats up..

    Ok basically i have a contact form submission system.

    All the variable names are correct as i have already tested them so that cant be the problem.

    HTML Code:
    function sendcontact()
        {
        var type = document.getElementById("contact_type").value;
        var subject = document.getElementById("contact_subject").value;
        var email = document.getElementById("contact_email").value;
        var message = document.getElementById("contact_message").value;
        
        var sent = function()
        {
            document.getElementById("contact_form").innerHTML = "We have recieved your contact submission successfully!<br /><br />Please allow 72 hours for a reply.";    
        }
        var fail = function()
        {
            document.getElementById("contact_form").innerHTML = "Sorry, an error occured!<br /><br />If this keeps happening, please let us know by emailing <a href='mailto:[email protected]'>here</a> otherwise please try again later.<br /><br />We apologize for any inconvenience caused.";    
        }
        var loaded = function()
        {
            
        }
        
        new Ajax.Request('contactus.php',{postBody:'?send=send&type=' + type + '&subject=' + subject + '&email=' + email + '&message=' + message + '', method:'post', onLoaded:loaded, onSuccess: sent, onFailure: fail});
        }
    When i run that function it goes straight to the failure message.

    Any ideas whats wrong.

    Ive tried commenting out the sending code on the contactus page but that doesnt make a difference.

    Thanks for any help!
    Coming and going...
    Highers are getting the better of me

  2. #2
    Join Date
    Dec 2006
    Posts
    7,601
    Tokens
    95

    Latest Awards:

    Default

    now i have no idea what it is but i may aswell suggest something lol
    Code:
    '&message=' + message + '', method:'post', onLoaded:loaded,
    after the + message + you have nothing in the '' and in all the others you do.

    So yeh i have no idea lmao

  3. #3
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Code:
    function sendcontact()
        {
        var type    = $('contact_type').value;
        var subject = $('contact_subject').value;
        var email   = $('contact_email').value;
        var message = $('contact_message').value;
        
        var sent = function()
        {
            document.getElementById("contact_form").innerHTML = "We have recieved your contact submission successfully!<br /><br />Please allow 72 hours for a reply.";    
        }
    
        var fail = function()
        {
            document.getElementById("contact_form").innerHTML = "Sorry, an error occured!<br /><br />If this keeps happening, please let us know by emailing <a href='mailto:[email protected]'>here</a> otherwise please try again later.<br /><br />We apologize for any inconvenience caused.";    
        }
    
        var loaded = function()
        {
            
        }
        
        new Ajax.Request('contactus.php',{postBody:'?send=send&type=' + type + '&subject=' + subject + '&email=' + email + '&message=' + message , method:'post', onLoaded:loaded, onSuccess: sent, onFailure: fail});
        }

  4. #4
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Nope, still getting an error.

    contactus.php file contents:
    PHP Code:
    <?php
    if($_POST["send"]=="send")
    {
             function 
    clean($str)
            {
            
    $str strip_tags(addslashes(stripslashes(htmlspecialchars($str))));
            
    $str mysql_real_escape_string($str);
            return 
    $str;
            }
            
        
    $type clean($_POST["type"]);
        
    $subject clean($_POST["subject"]);
        
    $email clean($_POST["email"]);
        
    $message clean($_POST["message"]);
        
    $message nl2br($message);
        
        
    $mailbody " Message Subject: $subject \n Reply-To Address: $email \n\n Message \n $message";
        
    $subject "HabboSoft Contact - [$type]";
        
         
    mail("[email protected]",$subject,$mailbody,"from: <$email>");
    }
    ?>

    <html>

    <head>
    <meta http-equiv="Content-Language" content="en-gb">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>Welcome to the Contact Us page</title>
    </head>

    <body>

    <p><font face="Verdana" size="1">Welcome to the <font color="#51A5E3"><b>Contact 
    Us</b></font> page. If you wish to order a product from us, ask us a question or 
    simply provide us with some feedback, then this is where you can send it from. 
    All replies will be read by either <font color="#51A5E3"><b>Cj555</b></font> or </font><img border="0" src="page/cj555_desk.png" width="146" height="112" align="right"><font face="Verdana" size="1">
    <font color="#51A5E3"><b>C</b></font></font><font face="Verdana" size="1"><font color="#51A5E3"><b>-Storm</b></font> and will be replied to if it is 
    required to. We aim to reply to all emails within <b>72</b> hours. However, 
    please note that this may not always be the case and we advise that if you do 
    not receive a reply within 14 days, you should resend your order/query/feedback 
    to us.</font></p>

    <p>
    <font face="verdana" size="1">
    <div id="contact_form">
    Type of Querie:<br />
    <select name="type" id="contact_type">
        <option selected="selected">Choose One..</option>
        <option>Sales</option>
        <option>Support</option>
        <option>Suggestion</option>
        <option>Other</option>
    </select><br /><br />
    Message Subject:<br />
    <input name="subject" id="contact_subject" type="text" size="30" /><br /><br />
    Your Email Adress:<br />
    <input name="email" id="contact_email" type="text" size="40" /><br /><br />
    Your Message:<br />
    <textarea name="message" cols="40" rows="5" id="contact_message"></textarea><br /><br />
    <input type="submit" value="Contact Us!" onclick="sendcontact()" /><input type="reset" value="Clear Form" onclick="cls()" />
    </div>
    </font>
    </p>

    </body>

    </html>
    Coming and going...
    Highers are getting the better of me

  5. #5
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    It would help if you could tell us what error you are getting..

  6. #6
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Still the same problem as was happening first..

    The function is going straight to the onFailure condition.
    Coming and going...
    Highers are getting the better of me

  7. #7
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Well since you're not using onLoaded, why do you have that defined in your options?

  8. #8
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Im using jakes code as a template. At first i tried it without the onLoaded function present but that went to the onFailure message too. So i put it back in and havent removed it again yet.
    Coming and going...
    Highers are getting the better of me

  9. #9
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    HTML Code:
    function sendcontact()
    {
    
    	var type = document.getElementById("contact_type").value;
    	var subject = document.getElementById("contact_subject").value;
    	var email = document.getElementById("contact_email").value;
    	var message = document.getElementById("contact_message").value;
    	
    	var sent = function()
    	{
    		document.getElementById("contact_form").innerHTML = "We have recieved your contact submission successfully!<br /><br />Please allow 72 hours for a reply.";	
    	}
    
    	var fail = function()
    	{
    		document.getElementById("contact_form").innerHTML = "Sorry, an error occured!<br /><br />If this keeps happening, please let us know by emailing <a href='mailto:[email protected]'>here</a> otherwise please try again later.<br /><br />We apologize for any inconvenience caused.";	
    	}
    	
    	new Ajax.Request('contactus.php',
    	{
    		
    		parameters:'send=send&type=' + type + '&subject=' + subject + '&email=' + email + '&message=' + message + '',
    		method:'post',
    		onSuccess: sent,
    		onFailure: fail
    	}
    	);
    
    }
    If it doesn't work, upload the two files and give me the URL.

  10. #10
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    Nope still not working =[
    Coming and going...
    Highers are getting the better of me

Posting Permissions

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