i am trying to write a general function.
I need to pass the webcontrol ids as paramater to the function as well.
the code looks like and i have similar codeblocks like below
---------
<asp:radiobutton id="radVMYes" runat="server" CssClass="radbtn" Text="Yes"
GroupName="radVM"></asp:radiobutton>
<asp:radiobutton id="radVMNo" runat="server" CssClass="radbtn" Text="No"
GroupName="radVM" Checked = "true"></asp:radiobutton>
Qty: <asp:textbox id="txtVMQty" runat="server" Columns="2"
cssclass="txtinput" enabled = "false">0</asp:textbox>
<asp:CustomValidator id="cvVMail" runat="server" ErrorMessage="Required"
ControlToValidate="txtVMQty"
ClientValidationFunction="ValidateQty"></asp:CustomValidator>
----------
"Brock Allen" <ba****@NOSPAMdevelop.com> wrote in message
news:46**********************@msnews.microsoft.com ...
It should be just this: ClientValidationFunction="ValidateQty"
And the signature of the method should take 2 arguments, the first is the
validation tag and the seconds is the args to say if valdation passed or
not:
function ValidateQty(sender, args){
if (document.getElementById(sender.controltovalidate) .checked){
if (document.getElementById(sender.controltovalidate) .value <= 0){
args.IsValid = false;
}}}
-Brock
DevelopMentor
http://staff.develop.com/ballen
Hi
I have a set of Yes/No radio buttons with textboxes for each. I need
to write a common customvalidation function that checks, if
radiobutton "yes" is selected, the value in the corresponding textbox
should be greater than 0.
For eg:
IsVM Qty: <radX0Yes> YES <radX0No> NO Qty: <txt00>
IsVM1 Qty: <radX1Yes> YES <radX1Yes> NO Qty: <txt11>
IsVM2 Qty: <radX2Yes> YES <radX2Yes> NO Qty: <txt22>
IsVM3 Qty: <radX3Yes> YES <radX3Yes> NO Qty: <txt33>
I created a customvalidator with clientsidevalidation for each set.
<asp:CustomValidator id="cvVM" runat="server" ErrorMessage="Required"
ControlToValidate="txtVMQty"
ClientValidationFunction="ValidateQty('radX0Yes',' txt00')"></asp:Custo
mValid
function ValidateQty(objRadId,objTxtBoxId){
if (document.getElementById(objRadId).checked){
if (document.getElementById(objTxtBoxId).value <= 0){
arguments.IsValid = false; ??????
}}}
How can i make the arguments.IsValid to false or true based on the
condition?
Thanks
Gane