Last post Apr 19, 2007 10:43 AM by SKT_01
Apr 18, 2007 04:28 AM|leila|LINK
I have a .Net mobile page that contains a simple mobile form with some textboxes and a submit button. What I'm trying to do is that I wanna write a script that checks the value of textboxes to make sure they are not empty and if otherwise write an error message
on the screen. I have used the "Page.ClientScriptStartupScript()" but still have some confusion.
any help is much appreciated.
Thanks in advance
Apr 18, 2007 04:34 PM|bobbyz|LINK
You need to use conetnt template of a device specific to send javascrip to the client.
But why do all this when you can do the validation on the server side after the postback from client, using your regular mobile control? If textbox is empty send an error back to the client. It is very simple. For example change the text of a mobile label
control to the Error Message, when textbox is empty.
Or you can use the validator mobile controls. Off course both these solutions require a postback to the server.
Apr 19, 2007 04:14 AM|leila|LINK
Thanks for your reply.
I agree that using mobile validation tools are so easy and comfortable to work with, however, I gotta use client-side validation in order to reduce server time consumption. To be honest I kinda am forced to do that. I have used the ContentTemplate in DeviceSpecific
in a mobile form. The problem is that I have put the name of the validation function in the OnClick ttibute of the submit button, and when it is clicked either it gives an error that my function name is not defined in the context or sometimes the page runs
but nothing happens.
If you have any idea what is going wrong or have a sample code for this, it would help a lot.
Thanks in advance.
Apr 19, 2007 10:43 AM|SKT_01|LINK