Donate SIGN UP

HELP Javascript validation

Avatar Image
lawstudent21 | 22:27 Sat 28th Apr 2012 | Technology
6 Answers
HELP
I have been trying to validate this form for ages (text boxes, checkboxes, radio buttons), everything i have been trying doesn't work! Here is part of the script. Anyone any ideas of what to try?!


function doSubmit()

alert("Your query has been sent.");
return;

}

</script>



</head>

<body>

<div id="formWrap">
<div id="form">
<div class="row">
<div class="label"> Establishment Name</div> <!--end

.label-->
<div class="input">
<input type="text" id="establishment" class="detail"

name="establishment" value="" />
</div> <!--end .input-->
</div> <!-- end .row -->
<div class="row">
<div class="label"> Contact Inital</div> <!--end .label-->
<div class"input">
<label>
<input type="radio" name="inital" value="radio"

id="inital_0" />
Mr</label>
<br />
<div class="row">
<div class="label"> &nbsp;&nbsp;&nbsp </div> <!--end

.label-->
<div class"input">
<label>
<input type="radio" name="inital" value="radio"

id="inital_1" />
Mrs</label>


<br />
<div class="row">
<div class="label"> &nbsp;&nbsp;&nbsp </div> <!--end

.label-->
<div class"input">
<label>
<input type="radio" name="inital" value="radio"

id="inital_2" />
Miss</label>

<br />
<div class="row">
<div class="label"> &nbsp;&nbsp;&nbsp </div> <!--end

.label-->
<div class"input">
<label>
<input type="radio" name="inital" value="radio"

id="inital_3" />
Ms</label>
</div> <!--end .input-->
</div> <!--end .row-->
<div class="row">
<div class="label"> Contact First Name </div> <!--end

.label-->
<div class="input">
<input type="text" id="firstname" class="detail"

name="firstname" value="" />
</div> <!--end .input-->
</div> <!-- end .row -->

<div class="row">
<div class="label"> Contact Surname </div> <!--end

.label-->
<div class="input">
<input type="text" id="surname" class="detail"

name="surname" value="" />
</div> <!--end .input-->
</div> <!-- end .row -->

<div class="row">
<div class="label">
<p>Contact Telephone Number </p>
</div> <!--end .label-->
<div class="input">
<input type="text" id="telephone" class="detail"

name="telephone" value="" />
</div> <!--end .input-->
</div> <!-- end .row -->
<div class="row">
<div class="label"> Preferred Contact Time</div> <!--end

.label-->
Gravatar

Answers

1 to 6 of 6rss feed

Best Answer

No best answer has yet been selected by lawstudent21. Once a best answer has been selected, it will be shown here.

For more on marking an answer as the "Best Answer", please visit our FAQ.
So what have you tried so far? Or are you actually expecting somebody to write the JavaScript for you...?
Question Author
No, if i wanted someone to write it for me i would of put all the script in!
I have been trying to use the function validateText with var est ect, for text boxes and for radios using function validateRadio () with if(document.contactform.small[0].checked == 0) return false not having any luck though. Was just wondering if anyone knew another way to do it. I have also tried in dreamweaver adding the spry validation but it won't let me select it.
-- answer removed --
> i would of

Ouch...
I'm feeling the pain too.
First things first: validateRadio() isn't a standard JavaScript method - where are you getting that from?

Secondly, your HTML makes no mention of a <form /> object with an id of 'contactform', so document.contactform is NEVER going to work. Use document.getElementById instead:

http://stackoverflow....elected-in-javascript

1 to 6 of 6rss feed

Do you know the answer?

HELP Javascript validation

Answer Question >>

Related Questions

Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.