I can't make the phone field required

a9ka9k Member
in Bugs & Feature Requests edited July 2008
Here is what I have in checkout. I think I've followed the rules but in preview the phone field still doesn't have an asterisk. I tried moving the javascript to head, tried just before end of body. Nothing works for me.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">;
<html xmlns="http://www.w3.org/1999/xhtml">;
<head>
	<title>^^store_name^^ Checkout</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="https://^^store_domain^^/themes/text/styles.css"; type="text/css" media="screen" charset="utf-8" />
</head>

<body id="checkout">
	<div id="pageContainer" style="width:760px; margin:0px auto;">
		^^cart^^
		^^checkout^^
	</div>
<script type="text/javascript" charset="utf-8">
/* <![CDATA[ */
	$j(document).ready(function(){
		// add the required class
		$j("#customer_phone").addClass("fc_required");
		// add an asterisk to the label
		$j("#li_customer_phone label.fc_label_left").append("<span class=\"fc_ast\">*<\/span>");
		// add an error label after the phone
		$j("#customer_phone").after('<label for="customer_phone" class="fc_error" style="display:none">Please enter your phone number.<\/label>');

		// Now add the onblur error checking events
		$j("#customer_phone").blur(function() {
			if (this.value == "") {
				fc_UpdateErrorDisplay(this.name,true);
			} else {
				fc_UpdateErrorDisplay(this.name,false);
			}
		});
	});
/* ]]> */
</script>

^^custom_begin^^
 
<h2>Additional Information</h2>
 
<fieldset id="fc_custom_fields">
	<legend>Additional Information</legend>
	<div class="fc_inner">
		<div>
			<h4>Updates</h4>
			<input type="checkbox" name="Update_List" value="yes" checked="checked" />
			<label for="Update_List">Leave this box checked to receive occasional updates about our products. We will not share your email address, and you can unsubscribe at any time.</label>
 
		</div>
		<div>
			<h4>Comments?</h4>
			<p>If you have any comments about your order, or about our checkout process, please let us know.</p>
			<textarea name="Comments" cols="60" rows="4"></^^textarea^^>
		</div>
	</div><!-- .fc_inner -->
</fieldset><!-- #fc_custom_fields -->
^^custom_end^^
</body>
</html>
Comments
  • lukeluke FoxyCart Team
    Hey a9k.

    Unfortunately... I'm about to give you the standard "it works on my computer" answer. I used the code you pasted here and it worked exactly as expected in FireFox 2. Are you using FireBug? Do you see any errors? What browser and browser version are you using?
  • brettbrett FoxyCart Team
    @a9k: Did you get this working? If you want to whisper me your URL I'll take a look.
  • a9ka9k Member
    Brett,
    Sorry I just got back from 4200 mile drive visiting my kids, and barely avoiding Sturgis.
    We're setup and running at:
    http://www.solari.com/store/
    if you want to take a look.
  • brettbrett FoxyCart Team
    Hey a9k.
    I'm testing in FF3 and Safari 3 and I'm seeing the asterisk and the required behavior as expected. Did you get this sorted out? Looks like it, but if not let me know specifically what's not behaving as it should.
Sign In or Register to comment.