WordPress.org

Ready to get started?Download WordPress

Forums

Required fields (1 post)

  1. kkhalifax
    Member
    Posted 3 years ago #

    Hi all,

    Using the Cadmus Theme which includes a contact form. The contact has required fields that don't work (ie. people can submit no matter how much they've filled in). I'm hoping to make certain fields required and include a message "Please fill out xyz..." I'm pretty sure the below code from header.php is what I need to alter, but I could be wrong.

    $("#submit_ajaxform").click(function() {
    var name = $("#author").val();
    var email = $("#email").val();
    var comment = $("#comment").val();
    var cad_email = '<?php echo $cad_email; ?>';

    var dataString = 'name='+ name + '&email=' + email + '&comment=' + comment + '&adminmail=' + cad_email;

    $.ajax({
    type: "POST",
    url: "<?php bloginfo('template_directory'); ?>/ajax_form.php",
    data: dataString,
    success: function() {
    $('#ajax_form').html("Message Submitted!");

    Any suggestions for changes I can make to ensure the form isn't submitted without completing these fields?

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic