SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot shiftless's Avatar
    Join Date
    Mar 2005
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    is there a character limit to form field names?

    I have this simple form that I am trying to validate, making sure each field is not blank. The problem is I have a very simple validation that works, but only if I use short names for the inputs. The problem is that the form is generated by a thrid party and I cannot change the names. Instead of 'template', for example, I must use the name "00N50000001I6Xb". if I change the input name/id and then the corresponding javascript (ie. signup.00N50000001I6Xb.value) to these, it breaks my validation. Is there a character limit on how you can name inputs? Or is it something else? If anyone can explain why this breaks my validation, I'd be much obliged. And as you can see by my javascript skills, I am not a programmer, so please don't suggest anything too complicated, it would just be beyond me.

    javascript:

    Code:
    <script type="text/javascript">
    function validate_form(thisform)
    {
    if (signup.template.value == "") {
    	alert("Please choose a template for your site!");
      signup.template.focus();return false;}
    if (signup.type.value == "") {
    	alert("Please tell us what type of club you have!");
      signup.type.focus();return false;}
    if (signup.company.value == "") {
    	alert("Please choose a name for your club!");
      signup.company.focus();return false;}
    if (signup.first_name.value == "") {
    	alert("Please fill in your first name!");
      signup.first_name.focus();return false;}
    if (signup.last_name.value == "") {
    	alert("Please fill in your last name!");
      signup.last_name.focus();return false;}
    if (signup.email.value == "") {
    	alert("You must provide us with an email address!");
      signup.email.focus();return false;}
    if (signup.phone.value == "") {
    	alert("Please fill in your phone number!");
      signup.phone.focus();return false;}
    if (signup.city.value == "") {
    	alert("Please fill in your city of residence!");
      signup.city.focus();return false;}
    if (signup.state.value == "") {
    	alert("Please fill in your state of residence!");
      signup.state.focus();return false;}
    if (signup.country.value == "") {
    	alert("Please fill in your country of residence!");
      signup.country.focus();return false;}
    if (signup.number.value == "") {
    	alert("Please fill in the number of members you have!");
      signup.number.focus();return false;}
    if (signup.number.value == "") {
    	alert("Please fill in the number of members you have!");
      signup.number.focus();return false;}
    if (signup.refer.value == "") {
    	alert("Please tell us how you found us!");
      signup.refer.focus();return false;}
    if (!document.signup.tac.checked){
    	alert("You must agree to the Terms and Conditions before proceeding!");
    	return false; } 
    	return true;
    }
    
    </script>

    ok, it's not letting me post the html form code (too many [img] or <img> tags!?! there aren't any!) so I will try to post that in a new message

  2. #2
    SitePoint Zealot shiftless's Avatar
    Join Date
    Mar 2005
    Posts
    137
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow here is the html

    Code:
    <form name="signup" method="post" onsubmit="return validate_form(this);" action="action-removed">
       
    <input type="hidden" value="00D500000006qei" name="oid" /> 
    <input type="hidden" value="http://clubspaces.d4sportsclub.com/page.aspx?id=25" name="retURL" />  
    <table class="signupTable" border="0" cellspacing="0" cellpadding="5" width="500">
    	<tr valign="top">
    		<td width="125"><label for="template">Template Selection</label></td>
    		<td><select name="template" id="template" title="Template Selected">
    			<option value=""></option>
    			<option value="GirlScout1">GirlScout 1
    			<option value="GirlScout2">GirlScout 2
    			<option value="GirlScout3">GirlScout 3
    			<option value="GirlScout4">GirlScout 4
    			<option value="BoyScout1">BoyScout 1
    			<option value="BoyScout2">BoyScout 2
    			<option value="BoyScout3">BoyScout 3
    			<option value="BoyScout4">BoyScout 4
    			<option value="MothersClub1">MothersClub 1
    			<option value="MothersClub2">MothersClub 2
    			<option value="MothersClub3">MothersClub 3
    			<option value="MothersClub4">MothersClub 4
    			<option value="OtherClub1">OtherClub 1
    			<option value="OtherClub2">OtherClub 2
    			<option value="OtherClub3">OtherClub 3
    			<option value="OtherClub4">OtherClub 4
    			</option>
    			</select>&nbsp;<a href="#" target="new">View the template designs here</a></td>
    	</tr>
    	<tr valign="top">
    		<td><label for="clubtype">Club Type</label></td>
    		<td><select name="type" id="type" title="Club Type">
    			<option value=""></option>
    			<option value="Boy Scout">Boy Scout</option>
    			<option value="Charity Club">Charity Club</option>
    			<option value="Girl Scout">Girl Scout</option>
    			<option value="Mothers Club">Mothers Club</option>
    			<option value="Newcomer Club">Newcomer Club</option>
    			<option value="Parent Group">Parent Group</option>
    			<option value="School">School</option>
    			<option value="Other">Other</option>
    			</select></td>
    	</tr>
    	<tr valign="top">
    		<td><label for="clubname">Club Name</label></td>
    		<td><input type="text" name="company" size="20" id="company" maxlength="255" /></td>
    	</tr>
        <tr valign="top">
    		<td><label for="first_name">First Name</label></td>
    		<td><input type="text" name="first_name" size="20" id="first_name" maxlength="40" /></td>
    	</tr>
        <tr valign="top">
    		<td><label for="last_name">Last Name</label></td>
    		<td><input type="text" name="last_name" size="20" id="last_name" maxlength="40" /></td>
    	</tr>
        <tr valign="top">
    		<td><label for="email">Email</label></td>
    		<td><input type="text" name="email" size="20" id="email" maxlength="80" /></td>
    	</tr>
        <tr valign="top">
    		<td><label for="phone">Telephone</label></td>
    		<td><input type="text" name="phone" size="20" id="phone" maxlength="40" /></td>
    		</tr>
        <tr valign="top">
    		<td><label for="city">City</label></td>
    		<td><input type="text" name="city" size="20" id="city" maxlength="40" /></td>
    	</tr>
        <tr valign="top">
    		<td><label for="state">State/Province</label></td>
    		<td><input type="text" name="state" size="20" id="state" maxlength="20" /></td>
    	</tr>
        <tr valign="top">
    		<td><label for="country">Country</label></td>
    		<td><input type="text" name="country" size="20" id="country" maxlength="40" /></td>
    		</tr>
        <tr valign="top">
    		<td><label for="number">Number of Members</label></td>
    		<td><input type="text" name="number" size="20" id="number" maxlength="255" /></td>
    	</tr>
        <tr valign="top">
    		<td><label for="find">How did you find us?</label></td>
    		<td><textarea name="refer" id="refer"></textarea></td>
    		</tr>
        <tr valign="top">
    		<td><label for="description">Notes</label></td>
    		<td><textarea name="description"></textarea></td>
    		</tr>
        <tr valign="top">
    		<td></td>
    		<td><input type="checkbox" name="tac" id="tac" />I agree to the <a href="#">Terms and Conditions</a>.</td>
    	<tr valign="top">
    		<td></td>
    		<td><input type="submit" name="submit" /></td>
    	</tr>
    </table>
    </form>


Bookmarks

Posting Permissions

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