RE: CustomValidator

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Allen,

Tried as suggested. However I get error during the update process. When I
enter Edit it works, when I select Update I get this error.
error "Microsoft JScript runtime error: Object required"
on line "var clientid = document.getElementById("hidden1").value"

I tried using the gridview1_itemUpdating script similar to the
textbox3_prerender but the update goes directly to the jscript.

What am I doing wrong?

How is validation done normally, custom validating the values between 2 or
more fields? This client side validation seems quite complex for 1 field, I
cannot imaging maintaining for additional fields. Is this complicated as I
have each field in its own template in a gridview? Is a better design to
keep all fields as a single template field (I loose the sorting or would then
have to do some manual work around).

I thought field validations would be so simple. Your help and advice are
much appreciated.

I emailed you the page code.

--
Thanks
Morris


"Allen Chen [MSFT]" wrote:

Hi Morris,

Thanks for the update. I think you can try following steps to solve this
problem:

1. Add the PreRender event handler for TextBox3:
<asp:TextBox onprerender="TextBox3_PreRender" ID="TextBox3" …
protected void TextBox3_PreRender(object sender, EventArgs e)
{
TextBox tb = (TextBox)sender;
this.hidden1.Value = tb.ClientID;
}

2. Add following code above the <asp:GridView>
<input type="hidden" runat="server" id="hidden1" />
<script type="text/javascript">
function NotfType_RecNo(sender, args) {
var clientid = document.getElementById("hidden1").value;
var tb3 = document.getElementById(clientid);
var tb3Value = tb3.value;
var ddl1Value = args.Value;

if (ddl1Value == "6")
{
if (tb3Value == "0")
{
args.IsValid = true;
}
else
{
args.IsValid = false;

}
}

}
</script>

Regards,
Allen Chen
Microsoft Online Support


.



Relevant Pages

  • Re: Previous versions of Office wont uninstall when deploying Off
    ... The main Microsoft focus appears to be the "home user who is a member of the Administrators group", and who interacts with the computer by "clicking" things. ... Vista makes extensive use of Reparse Points, but if you put those words into the help file, it starts offering help about "Wireless access points"! ... var cArgs = WScript.Arguments; ... It will uninstall if I use a custom .MSP file. ...
    (microsoft.public.office.setup)
  • Re: Previous versions of Office wont uninstall when deploying Off
    ... It's been the case for a long time that Microsoft products are becoming ... The Vista help file is another good example. ... var cArgs = WScript.Arguments; ... It will uninstall if I use a custom .MSP file. ...
    (microsoft.public.office.setup)
  • [NT] IE Allows Universal Cross Site Scripting
    ... * Microsoft Internet Explorer ... When both pages are on the same protocol, port, and domain, the validation ... and it is as such possible to bounce a HTTP redirect from ...
    (Securiteam)
  • Re: Vistas EULA Product Activation Worries
    ... Just have your mobile phone handy if you've got your Dell halfway up a mountain when Vista decides a check up is due. ... It certainly doesn't imply your computer will become a paperweight if this validation check fails. ... If "some" means everything except your internet connection and an upgrade sales pitch, ... "Microsoft will continue to check if Vista was legitimately acquired, ...
    (comp.sys.mac.advocacy)
  • Re: Vistas EULA Product Activation Worries
    ... Just have your mobile phone handy if you've got your Dell halfway up a mountain when Vista decides a check up is due. ... It certainly doesn't imply your computer will become a paperweight if this validation check fails. ... If "some" means everything except your internet connection and an upgrade sales pitch, ... "Microsoft will continue to check if Vista was legitimately acquired, ...
    (comp.sys.mac.advocacy)