...

View Full Version : How to find control in formview from javascript



AkAlan
03-11-2009, 01:54 AM
I'm trying to retrieve the value of a text box "txtDrumNumber" so I can run a validation script. I can't seem to get the correct method for this. Here is what has been suggested but didn't work.

<script type="text/javascript">
function isValidDrumNumber(sender, args) {
var DrumNumber = fvAddNewDrum.FormviewRow.FindControl("txtDrumNumber").ClientID;
var DrumString = DrumNumber.value;
if (DrumString.length = 11) {
return true;
}
else {
DrumNumber.focus();
args.IsValid = false;
return false;
}
}
</script>

abduraooft
03-11-2009, 09:59 AM
var value=document.getElementById('myinput');
alert(value);


<input type="text" name="myinput" id="myinput">
The above should work in all cases(with no major errors in markup).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum