Hmm, I thought I'd tried the inline assignment of the ClientID to the
javascript function and had a problem with it. I'll have to give that
another shot.
Anyway, I did, in the meantime, manage to attach to the submit event and get
the functionality I wanted...
<script language="javascript">
window.onload = checkSel;
function checkSel() {
<<do a check to see if I'm on the right view>>
if (<<we are on the right view>>) {
document.forms[0].onsubmit = valPType;
}
}
function valPType() {
if (document.getElementById('hdnID').value != 0) {
return true;
}
else {
alert('Please indicate the type of partnership in which you wish
to participate.');
return false;
}
}
</script>
"Daniel Fisher(lennybacon)" <info@(removethis)lennybacon.com> wrote in
message news:Oj**************@TK2MSFTNGP15.phx.gbl...
"Random" <ci*******@hotmail.com> wrote in message
news:%2***************@TK2MSFTNGP09.phx.gbl... Is there a simple way to get a RequiredFieldValidator to work with a
non-server control?
Nope!
I have a hidden field that I cannot make into a server control because I
have to change it's value with client side javascript. But I do want to
make sure I validate there is a value before the form is submitted.
???
YOU CAN!!!
<%
MyHiddenField.Attributes("style") = "display:none;";
%>
<asp:Textbox ID="MyHiddenField" Runat="server" />
<script language="javascript">
document.-getElementById('<%=MyHiddenField.ClientID%>').valu e = 'xxx';
</script>
Where ist the problem?
I can write a client side function myself for this, but since I'm using
an <asp:LinkButton /> for the submit action, I'm not sure how I'd
interfere with the submit process.
--
Daniel Fisher(lennybacon)
MCP ASP.NET C#
Blog: http://www.lennybacon.com/