How does one implement client-side scripts(<SCRIPT...) using the ASP .NET mobile designer? Is there another way to do client-side validation and avoid a round trip? Have I missed a switch/config item
If I try to specify the script using onclick="myscript()" in a mobile: control I get a compile error that the script doesnt exist
the ClientValidationFunction attribute seems to be missing from all the mobile: controls too
Thank
Geoff p
How does one implement client-side scripts(<SCRIPT...) using the ASP .NET mobile designer? Is there another way to do client-side validation and avoid a round trip? Have I missed a switch/config item
If I try to specify the script using onclick="myscript()" in a mobile: control I get a compile error that the script doesnt exist
the ClientValidationFunction attribute seems to be missing from all the mobile: controls too
Thank
Geoff
Hello Geoff,
You are right here. The validation controls in the Mobile Internet Toolkit
are descended from the similar ASP.NET controls intended for desktop
clients. However, unlike those controls, which might add Javascript into
the Web page sent to desktop browsers to perform client-side validation,
they never execute on the client. Instead, they execute on the server,
after the client posts the form data. If the data is invalid, you can
program against this result or allow ASP.NET to return the page to the user
for correction.
So ClientValidationFunction doesn't exist for validator controls in ASP.NET
mobile programming. In order to achieve client side scripting for
validation, we need to use client side java script to do so. For an
example: (sample code from hs's reply in the newsgroup before)
<mobile:form id="Form9" runat="server">
<mobile:Panel id="Panel3" runat="server">
<mobile:DeviceSpecific id="Devicespecific3" runat="server">
<Choice Filter="isHTML32">
<ContentTemplate>
<Script for="window" event="onload" language="jscript">
window.Form9.TextBox6.focus();
window.Form9.TextBox6.onchange = text_changed;
function text_changed(e)
{
alert("you cracked it");
document.Form9.reset();
}
</Script>
</ContentTemplate>
</Choice>
</mobile:DeviceSpecific>
</mobile:Panel>
<mobile:TextBox id="TextBox6" runat="server"></mobile:TextBox>
<mobile:Command id="Command7" runat="server" BackColor="White"
ForeColor="White"></mobile:Command>
</mobile:form>
Hope that helps.
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ?C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
kefren - 15 Mar 2004 10:01 GMT
Thanks Yanhon
I have seen the templates stuff in msdn and remember seeing a reference to scripts. I think I'll make progress now
Geoff p
Yan-Hong Huang[MSFT] - 15 Mar 2004 10:58 GMT
Hi Geoff,
That is good. I am glad to be of assistance.
Thanks and have a good day. :)
Best regards,
Yanhong Huang
Microsoft Community Support
Get Secure! ?C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.