[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

Re: Client Side Validation in Mobile Form

Santosh

7/7/2003 9:29:00 PM

Hi,
Thanx 4 all the help. I have tried using .submit and
__doPostBack and its working fine. Now i have two new
problems:
1. On submit, i validate and get new value (equivalent to
user entered value). This value now has to be populated in
Text box in which the user has entered the value (replace)
and the old form needs to be shown again. how do we do
this???
2. I have different validation methods for different text
boxes so i call submit at tab out of each text box. How do
i know that the postback is from which particular textbox
so as to arrange my validation code.
Thanx in advance,
Santosh





>-----Original Message-----
>I'm surprised you get an error with form.reset() as this
is quite basic
>client-side javascript. Mobile aspx supports javascript
1.0 and some 1.1.
>Best way to find out whats supported is to try it out.
>Any javascript book will do (the one i use
is 'Javascript. The Definitive
>Guide' by David Flanagan [O'Reilly]....check on amazon).
>The answer to your second question is yes you can call a
server side method.
>I actually asked this question a 4-5 months ago (i'm not
an expert either).
>The MS guys provided good answers on different approaches
(do a google
>search of this news group with my name [hs@nospam.syn]
and you should find
>some of the answers).....also do a search with
>'TextBox.onchange' or 'client-side text validation' ...i
think the subject
>line was called that. If you don't find anything i'll
give you more info.
>Just to give you an idea,
>you can do following javascript.
>
>// call text_changed if you trap the 'tab' press
>function text_changed(e)
>{
> window.Form9.submit();
> // or you can do
> __doPostBack("mytextbox", ""); // you can
specify which object is
>doing the submitting
>}
>
>If you're planning to get the server to do your text
validation then why do
>you need any clientside javascript? Just add a
TextChanged event to your
>mobile textbox e.g.
>this.TextBox4.TextChanged += new
>System.EventHandler(this.TextBox4_TextChanged);
>
>(visual studio does that automatically if you double
click the textbox in
>the designer).
>
>
>
>
>
>
>
>"Santosh" <santoshgawas@yahoo.com> wrote in message
>news:050801c331f8$9d6ef190$a101280a@phx.gbl...
>> Hi,
>> Thanx a lot. It worked but the second line
>> document.Form9.reset(); is giving me error. That is not
>> that important, but how can i know what all events are
>> supported by any control like here - u have written
>> onchange event. Secondly can u suggest me any javascript
>> related book as i have very little knowledge on the
same.
>> Lastly one small question, is it possible to submit the
>> form in the javascript function so as to call the server
>> side method at the tab out of the text box control
instead
>> of writing the code of validation in javascript file. If
>> yes, how do we do that?????? Once again thanx a lot for
>> all ur kindly help.
>> Regards,
>> Santosh
>>
>>
>>
>> >-----Original Message-----
>> >try the following:
>> >
>> ><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>
>> >
>> >
>> >"Santosh" <santoshgawas@yahoo.com> wrote in message
>> >news:04c101c32c78$0ee03c20$a301280a@phx.gbl...
>> >> Hi,
>> >> First of all thanx for the reply. I have tried
>> >> this code but my requirement is somewhat different.
>> >> I have written the following code for the same but it
>> >> doesn't work. Firts to tell u in brief abt my
>> >> requirement: Actually i want to validate the text box
>> >> on the tab out just as we do it in VB. But i don't
>> >> know how to do that. I have searched a lot but
>> >> nothing.
>> >> Just look at the code and tell me what is wrong in
>> >> this. The function doesn't get fired at all.
>> >> <Mobile:Form id="Form1" runat="server">
>> >> <Mobile:TextBox id="txtPrimeNumber" runat="server"
>> >> OnTextChanged="CheckPrime"
size="15"></Mobile:TextBox>
>> >> </Mobile:Form>
>> >> <script language="javascript">
>> >> <!--
>> >> function CheckPrime(sender, args)
>> >> {
>> >> var iPrime = parseInt(args.Value);
>> >> var iSqrt = parseInt(Math.sqrt(iPrime));
>> >>
>> >> for(var iLoop = 2; iLoop <= iSqrt; iLoop++)
>> >> {
>> >> if(iPrime % iLoop == 0)
>> >> {
>> >> alert("Not a Prime Number.");
>> >> return;
>> >> }
>> >> }
>> >> alert("Prime Number.");
>> >> }
>> >>
>> >> Plz, can u suggest me any book on this to refer to.
>> >> Anyways thanx in advance.
>> >> Regards,
>> >> Santosh
>> >>
>> >> >-----Original Message-----
>> >> >have you tried any client-side javascript eg
>> >> >(this was code i got from this group ages ago)
>> >> >
>> >> > <mobile:form id="Form7" title="Form 7"
runat="server"
>> >> BackColor="#C0C000">
>> >> > <mobile:Panel id="Panel2" runat="server">
>> >> > <mobile:DeviceSpecific id="Devicespecific2"
>> >> runat="server">
>> >> > <Choice Filter="isHTML32">
>> >> > <ContentTemplate>
>> >> > <Script for="window" event="onload"
>> >> language="jscript">
>> >> > if(window.Form7.TextBox3.value!="")
>> >> > {
>> >> > window.Form7.TextBox5.focus();
>> >> > }
>> >> > else
>> >> > {
>> >> > window.Form7.TextBox3.focus();
>> >> > }
>> >> > document.onkeypress = keyhandler;
>> >> > // Do your text validation here........there
>> isn't
>> >> any in this
>> >> >example
>> >> > // I'm only trapping keypresses
>> >> >
>> >> > function keyhandler(e)
>> >> > {
>> >> > Key = window.event.keyCode;
>> >> > //if escape is pressed
>> >> > if (Key == 27)
>> >> > {
>> >> > //alert("Esc key press has been trapped.");
>> >> > window.Form7.TextBox3.value ="Help";
>> >> > document.Form7.submit();
>> >> > //return (false);
>> >> > }
>> >> > if (Key != 0 && Key != 27)
>> >> > {
>> >> > alert("Key code pressed" + Key);
>> >> > // cancel key press as to not enter key
into
>> >> field
>> >> > return (false);
>> >> > }
>> >> > }
>> >> > </Script>
>> >> > </ContentTemplate>
>> >> > </Choice>
>> >> > </mobile:DeviceSpecific>
>> >> > </mobile:Panel>
>> >> > <mobile:Label id="Label9" runat="server"
>> >> >Font-Bold="True">Label</mobile:Label>
>> >> > <mobile:TextBox id="TextBox3"
>> >> runat="server"></mobile:TextBox>
>> >> > <mobile:Command id="Command3"
>> >> runat="server">Command</mobile:Command>
>> >> > <mobile:TextBox id="TextBox5"
>> >> runat="server"></mobile:TextBox>
>> >> > <mobile:Command id="Command6"
>> >> runat="server">Command</mobile:Command>
>> >> > </mobile:form>
>> >> >
>> >> >
>> >> >"Santosh" <santoshgawas@yahoo.com> wrote in message
>> >> >news:03f101c32bad$0d4ca810$a601280a@phx.gbl...
>> >> >> Hi,
>> >> >> I want to do client side validation on mobile
form.
>> >> How
>> >> >> to do that. Any sample code. It's not possible
>> through
>> >> >> CustomValidator as it does not have
>> >> >> ClientValidationFunction. Can anybody help me on
>> this.
>> >> >> Thanx in advance.
>> >> >> Regards,
>> >> >> Santosh
>> >> >>
>> >> >
>> >> >
>> >> >.
>> >> >
>> >
>> >
>> >.
>> >
>
>
>.
>