Click here to Skip to main content
15,887,683 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: php code Pin
Sandeep Mewara27-Jul-12 9:18
mveSandeep Mewara27-Jul-12 9:18 
GeneralRe: php code Pin
RichardGrimmer7-Sep-12 0:41
RichardGrimmer7-Sep-12 0:41 
QuestionVisual Studio Error Pin
MWRivera26-Jul-12 14:04
MWRivera26-Jul-12 14:04 
AnswerRe: Visual Studio Error Pin
Philippe Mori26-Jul-12 17:26
Philippe Mori26-Jul-12 17:26 
GeneralRe: Visual Studio Error Pin
MWRivera27-Jul-12 4:31
MWRivera27-Jul-12 4:31 
AnswerRe: Visual Studio Error Pin
WoodenLegNamedSmith2-Aug-12 7:58
WoodenLegNamedSmith2-Aug-12 7:58 
AnswerRe: Visual Studio Error Pin
Sakthivel Parasuraman2-Aug-12 23:57
Sakthivel Parasuraman2-Aug-12 23:57 
QuestionA simple contact form with validation Pin
Member 929983624-Jul-12 5:03
Member 929983624-Jul-12 5:03 
Hi I hope somone can help with my dilema I am using this code to load an external page (contact form ) into an ajax panel I have tried several (contact forms) some from this website however when I submit the form I get errors either saying it cannot find the page or it just refreshed to the main default page

<pre lang="java"><script type="text/javascript">
    $(document).ready(function () {

        $('#panel1').slidePanel({
            triggerName: '#trigger1',
            
            position: 'fixed',
            triggerTopPos: '475px',
            panelTopPos: '495px',
            ajax: true,
            panelOpacity: 0.8,
                    speed: 'slow',

                    clickOutsideToClose: true,
                    ajaxSource: '/ContactUs/Default.aspx'
        });
    });
</script>


this is the contact form I am trying to use
<pre lang="HTML"><html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Contact Us</title>
<script src="js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="js/jquery.validate.js" type="text/javascript"></script>
<script src="js/jquery.blockUI.js" type="text/javascript"></script>
<script type="text/javascript">
    $.validator.setDefaults({
        submitHandler: function() {
            $.blockUI({
                message: "<div style='color:White;'><h1>Thank you!</h1><br/><span style='font-size:12px;'>We'll get in touch with you asap.</span></div>",
                fadeIn: 500,
                fadeOut: 500,
                timeout: 3000,
                showOverlay: false,
                centerX: true,
                centerY: true,
                css: {
                    width: '350px',
                    right: '10px',
                    border: 'none',
                    padding: '5px',
                    backgroundColor: '#000',
                    '-webkit-border-radius': '10px',
                    '-moz-border-radius': '10px',
                    opacity: .6,
                    color: '#fff'
                }
            });
            this.document.form.submit();
        }
    });

    $().ready(function() {
        // validate the comment form when it is submitted
        $("#contactForm").validate({
            rules: {
                email: {
                    required: true,
                    email: true
                }
            }
        });
    });
</script>    
</head>
<body>
        <h1>Contact Us</h1>
        <form id="contactForm" action="contact.ashx">
            <table>
                <tr>
                    <td>
                        <label for="name">Name*</label>
                    </td>
                    <td>
                        <input id="name" name="name" class="txtField required"/>                    
                    </td>
                </tr>
                <tr>
                    <td><label for="email">E-mail*</label></td>
                    <td>
                        <input id="email" name="email" class="txtField  required" />
                    </td>
                </tr>
                <tr>
                    <td><label for="Phone">Phone</label></td>
                    <td><input id="phone" name="phone" class="txtField" /></td>
                </tr>
                <tr>
                    <td><label for="Message">Message*</label></td>                    
                    <td><textarea name="message" rows="5" cols="20" class="txtField required" id="Textarea1"></textarea></td>
                </tr>
                <tr>
                    <td style="text-align:right;"><input name="submit" type="submit" value="submit" /></td>
                </tr>
            </table>          
        </form>
</body>
</html>


and the code behind

C#
using System;
using System.Web;
using System.Net.Mail;

public class contact : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {

        MailMessage message = new MailMessage();
        message.From = new MailAddress("contact@southlabs.com");

        message.IsBodyHtml = false;

        // Proper Authentication Details need to be passed when sending email from gmail
        System.Net.NetworkCredential mailAuthentication = new
            System.Net.NetworkCredential("test@gmail.com", "passwords");

        // Smtp Mail server of Gmail is "smpt.gmail.com" and it uses port no. 587
        // For different server like yahoo this details changes and you can
        // Get it from respective server.
        System.Net.Mail.SmtpClient mailClient = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

        // Enable SSL
        mailClient.EnableSsl = true;
        mailClient.UseDefaultCredentials = false;
        mailClient.Credentials = mailAuthentication;        
    
        //add accounts to notify
        message.To.Add(new MailAddress("test@gmail.com"));      
        
        string name = context.Request.Params["name"];
        string email = context.Request.Params["email"];
        string phone = context.Request.Params["phone"];
        string msg = context.Request.Params["message"];        
        
        message.Subject = "[New Web Contact]: Message from "+ name;
        System.Text.StringBuilder builder = new System.Text.StringBuilder();        
        builder.AppendLine("Name:"+ name);
        builder.AppendLine("email: "+ email);
        builder.AppendLine("phone: " + phone);
        builder.AppendLine("Message: " + msg);

        message.Body = builder.ToString();


        mailClient.Send(message);
        context.Response.Redirect("default.aspx");             
    }
 
    public bool IsReusable {
        get {
            return false;
        }
    }

}

AnswerRe: A simple contact form with validation Pin
StianSandberg26-Jul-12 4:49
StianSandberg26-Jul-12 4:49 
QuestionFirst SOAP project coming up, need clarification Pin
MrAurora24-Jul-12 2:55
MrAurora24-Jul-12 2:55 
AnswerRe: First SOAP project coming up, need clarification Pin
jkirkerx24-Jul-12 8:22
professionaljkirkerx24-Jul-12 8:22 
GeneralRe: First SOAP project coming up, need clarification Pin
MrAurora25-Jul-12 0:22
MrAurora25-Jul-12 0:22 
GeneralRe: First SOAP project coming up, need clarification Pin
jkirkerx25-Jul-12 7:31
professionaljkirkerx25-Jul-12 7:31 
GeneralRe: First SOAP project coming up, need clarification Pin
MrAurora27-Jul-12 0:56
MrAurora27-Jul-12 0:56 
GeneralRe: First SOAP project coming up, need clarification Pin
jkirkerx27-Jul-12 7:21
professionaljkirkerx27-Jul-12 7:21 
Question.net client, java soap web services , validation from soap headers Pin
Anuradhaanu22-Jul-12 23:08
Anuradhaanu22-Jul-12 23:08 
AnswerRe: .net client, java soap web services , validation from soap headers Pin
Richard MacCutchan23-Jul-12 3:20
mveRichard MacCutchan23-Jul-12 3:20 
Questionsending data to script on web server Pin
Danzy8321-Jul-12 11:42
Danzy8321-Jul-12 11:42 
AnswerRe: sending data to script on web server Pin
Sandeep Mewara21-Jul-12 19:58
mveSandeep Mewara21-Jul-12 19:58 
AnswerRe: sending data to script on web server Pin
David Mujica23-Jul-12 2:22
David Mujica23-Jul-12 2:22 
GeneralRe: sending data to script on web server Pin
Danzy8323-Jul-12 4:34
Danzy8323-Jul-12 4:34 
GeneralRe: sending data to script on web server Pin
Andrei Straut23-Jul-12 9:04
Andrei Straut23-Jul-12 9:04 
GeneralRe: sending data to script on web server Pin
David Mujica23-Jul-12 11:05
David Mujica23-Jul-12 11:05 
AnswerRe: sending data to script on web server Pin
jkirkerx23-Jul-12 10:17
professionaljkirkerx23-Jul-12 10:17 
QuestionCGI in Java - Legacy but interesting (for educational purposes) Pin
ppign20-Jul-12 23:15
ppign20-Jul-12 23:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.