gum1982 Posted February 15, 2010 Share Posted February 15, 2010 Hi I have got a problem with the validation on my site. I cant seem to solve the problem. Every time i hit submit on my form, the form starts to validate but then refreshes. You can see my problem here. http://gponeclick.users32.interdns.co.uk/ I have got a form on my site that is submitting to an action of nothing. <form id="formID" class="formular" method="post" action=""> Has anyone had a similar problem or can give me some sort off reason why it would be doing this. The form is in a sidebar_all.php and is included in the index.php <div class="column"> <?php include (TEMPLATEPATH . "/sidebar_all.php"); ?> </div> I have deleted this and inserted all the form code into the index.php and it is still causing the problem. Anyone help please??? Link to comment https://forums.phpfreaks.com/topic/192110-refresh/ Share on other sites More sharing options...
Deoctor Posted February 15, 2010 Share Posted February 15, 2010 if u could post the code then it would be more easier to help u out Link to comment https://forums.phpfreaks.com/topic/192110-refresh/#findComment-1012471 Share on other sites More sharing options...
gum1982 Posted February 15, 2010 Author Share Posted February 15, 2010 Hi ym_chaitu This is the sidebar code. <h2 class="donate">donate <span>online today</span></h2> <form id="formID" class="formular" method="post" action=""> <fieldset> <ol> <li> <input value="First Name:" onfocus="this.value = (this.value=='First Name:')? '' : this.value;" class="validate[required,custom[onlyLetter],length[0,100]] text-input" type="text" name="firstname" id="firstname" /> </li> <li> <input value="Last Name:" onfocus="this.value = (this.value=='Last Name:')? '' : this.value;" class="validate[required,custom[onlyLetter],length[0,100]] text-input" type="text" name="lastname" id="lastname" /> </li> <li> <input value="Email address:" onfocus="this.value = (this.value=='Email address:')? '' : this.value;" class="validate[required,custom[email]] text-input" type="text" name="email" id="email" /> </li> <li> <input type="text" value="Address 1:" onfocus="this.value = (this.value=='Address 1:')? '' : this.value;" class="validate[required,custom[onlyLetter],length[0,100]] text-input" name="address1" id="address1" /> </li> <li> <input type="text" name="address2" value="Address 2:" onfocus="this.value = (this.value=='Address 2:')? '' : this.value;" class="text"/> </li> <li> <input type="text" value="Town:" onfocus="this.value = (this.value=='Town:')? '' : this.value;" class="validate[required,custom[onlyLetter],length[0,100]] text-input" name="town" id="town" /> </li> <li> <input type="text" value="Postcode:" onfocus="this.value = (this.value=='Postcode:')? '' : this.value;" name="postcode"/> </li> <li> <input value="Telephone:" onfocus="this.value = (this.value=='Telephone:')? '' : this.value;" class="validate[required,custom[telephone]] text-input" type="text" name="phone" id="phone" /> </li> </ol> </fieldset> <fieldset class="check"> <div class="campaign"> <input class="validate[required] radio" type="radio" name="data[user][preferedColor]" id="radio1" value="5"/> <label><span>£1</span><br /> a month</label> </div> <div class="campaign"> <input class="validate[required] radio" type="radio" name="data[user][preferedColor]" id="radio2" value="3"/> <label><span>one-off</span> donation</label> </div> <div class="campaign"> <input class="validate[required] radio" type="radio" name="data[user][preferedColor]" id="radio3" value="9"/> <label><span>regular</span> donation</label> </div> </fieldset> <div id="onelife"> <div class="container2"> thankyou you for choosing our one life campaign click next step to proceed to payment.</div> </div> <div id="monthly"> <div class="container2"> <h4>Please select a monthly amount from list</h4> <label class="monthly">£5 Monthly</label> <input class="monthly" type="checkbox" name="five" /> <div class="clear"></div> <br /> <label class="monthly">£10 Monthly</label> <input class="monthly" type="checkbox" name="first" /> <div class="clear"></div> <br /> <label class="monthly">£20 Monthly</label> <input class="monthly" type="checkbox" name="second" /> <div class="clear"></div> <br /> <label class="monthly">£30 Monthly</label> <input class="monthly" type="checkbox" name="30" /> <div class="clear"></div> <br /> <label class="monthly">£40 Monthly</label> <input class="monthly" type="checkbox" name="40" /> </div> </div> <div id="oneoff"> <div class="container2">Thanks for choosing to make a one off donation click next step to proceed to payment.</div> </div> <img class="gift" src="http://gponeclick.users32.interdns.co.uk/wp-content/themes/Going-Public/images/gift-aid.png" width="300" height="38" alt="gift aid" /> <fieldset class="giftaid"> <input type="checkbox" id="giftaid" title="Please agree to our policy!" name="giftaid" class="{validate:{required:false}}" /> <p class="giftaid"> I would like Going Public to reclaim the tax I have paid on this donation, any donation I have made in the six years prior to this year, and any donations I may make in the future. I am a UK taxpayer.</p> <br /> </fieldset> <fieldset class="terms"> <input title="Please agree to our policy!" class="validate[required] checkbox" type="checkbox" id="agree" name="agree"/> <p class="giftaid">I agree to be added to the Going Public email database.</p> </fieldset> <fieldset class="submit"> <input class="submit" type="submit" value="Validate & Send the form!"/> </fieldset> </form> </div> And here is the main header.php. <?php if(isset($_POST['submit'])){ header("http://gponeclick.users32.interdns.co.uk/thankyou.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php bloginfo('description') ?></title> <meta name="description" content="<?php bloginfo('description') ?>" /> <?php if(is_search()) { ?> <meta name="robots" content="noindex, nofollow" /> <?php }?> <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/style/css/validationEngine.jquery.css" /> <link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php bloginfo('rss2_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <script src="<?php bloginfo("template_url"); ?>/js/jquery.validationEngine-en.js" type="text/javascript"></script> <script src="<?php bloginfo("template_url"); ?>/js/jquery.validationEngine.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { //Hide div w/id extra $("#onelife").css("display","none"); // Add onclick handler to checkbox w/id checkme $("#radio-1").click(function(){ // If checked if ($("#radio-1").is(":checked")) { //show the hidden div $("#onelife").show("fast"); } else { //otherwise, hide it $("#onelife").hide("fast"); } }); $("#monthly").css("display","none"); // Add onclick handler to checkbox w/id checkme $("#radio-2").click(function(){ // If checked if ($("#radio-2").is(":checked")) { //show the hidden div $("#monthly").show("fast"); } else { //otherwise, hide it $("#monthly").hide("fast"); } }); $("#oneoff").css("display","none"); // Add onclick handler to checkbox w/id checkme $("#radio-3").click(function(){ // If checked if ($("#radio-3").is(":checked")) { //show the hidden div $("#oneoff").show("fast"); } else if ($("#radio-3").is(":unchecked")) { //otherwise, hide it $("#oneoff").hide("fast"); } }); }); </script> <script src="<?php bloginfo("template_url"); ?>/jquery.easing.1.3.js" type="text/javascript"></script> <script src="<?php bloginfo("template_url"); ?>/js/coda-slider-condensed.js" type="text/javascript" charset="utf-8"></script> <script type="text/javascript"> $(function() { $('.scrollButtons.left').hover(function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }, function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }); $('.scrollButtons.right').hover(function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }, function() { var currentImg = $(this).attr('src'); $(this).attr('src', $(this).attr('hover')); $(this).attr('hover', currentImg); }); }); </script> <?php wp_head(); ?> <script type="text/javascript"> $(document).ready(function() { // SUCCESS AJAX CALL, replace "success: false," by: success : function() { callSuccessFunction() }, $("#formID").validationEngine() //$.validationEngine.loadValidation("#date") //alert($("#formID").validationEngine({returnIsValid:true})) //$.validationEngine.buildPrompt("#date","This is an example","error") // Exterior prompt build example // input prompt close example //$.validationEngine.closePrompt(".formError",true) // CLOSE ALL OPEN PROMPTS }); </script> </head> <body> <div id="header" class="large"> <h1><a href="<?php echo get_option('home'); ?>/"> <?php bloginfo('name'); ?> </a></h1> <div id="search_box"> <?php get_search_form(); ?> </div> <!-- end search box --> <a class="sign" href="#">Sign</a> </div> <div id="menu" class="large"> <ul> <?php wp_list_pages('title_li='); ?> </ul> </div> Link to comment https://forums.phpfreaks.com/topic/192110-refresh/#findComment-1012477 Share on other sites More sharing options...
Deoctor Posted February 15, 2010 Share Posted February 15, 2010 in the side bar code u didnt mentioned any action value for the form.. <form id="formID" class="formular" method="post" action=""> u need to mention the action so that it should do that code after any one presses the button/submit Link to comment https://forums.phpfreaks.com/topic/192110-refresh/#findComment-1012479 Share on other sites More sharing options...
gum1982 Posted February 15, 2010 Author Share Posted February 15, 2010 Hi ym_chaitu thanks for the reply i wanted to form to validate first, then if their is no validation errors it will run the simple header redirect at the top off the header.php, <?php if(isset($_POST['submit'])){ header("http://gponeclick.users32.interdns.co.uk/thankyou.php"); } ?> Obviously i will be running more than this but i would like to get it working up to this point??? Link to comment https://forums.phpfreaks.com/topic/192110-refresh/#findComment-1012480 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.