Connecting Tech Pros Worldwide Forums | Help | Site Map

Validation

Bruno Alexandre
Guest
 
Posts: n/a
#1: Jun 12 '06
Using the RequiredFieldValidator I can show a message if the field is
empty...

....but How can I JUST SHOW that message if a selected value from a
DropDownList was previously selected?

I really can't figure out how to use Javascript with this new framewrok :-(

ASP 3.0 was much easy :-/

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)



Karl Seguin [MVP]
Guest
 
Posts: n/a
#2: Jun 12 '06

re: Validation


Well, you can use a CompareValidator that lets you check if a value isn't
something (or any type of operator you want).

The only "trick" about getting hand-written javascript to work in .NET vs
classic is the dynamic naming (ids) of controls. You can easily solve this
by using a control's ClientId property:

var country = document.getElementById("<%=country.ClientId %>");

you'll find that this is one of the very few times most people will agree
that you can/should use <%= in .NET

Karl

--
http://www.openmymind.net/



"Bruno Alexandre" <bruno.in.dk@gmail.com> wrote in message
news:e8cT5IgjGHA.4044@TK2MSFTNGP03.phx.gbl...[color=blue]
> Using the RequiredFieldValidator I can show a message if the field is
> empty...
>
> ...but How can I JUST SHOW that message if a selected value from a
> DropDownList was previously selected?
>
> I really can't figure out how to use Javascript with this new framewrok
> :-(
>
> ASP 3.0 was much easy :-/
>
> --
>
> Bruno Alexandre
> (a Portuguese in Københanv, Danmark)
>
>[/color]


Bruno Alexandre
Guest
 
Posts: n/a
#3: Jun 12 '06

re: Validation


but I have problems with that, because sometimes I get this error in
javascript,

document.getElementById() is nothing or is not an object...

so I run the page, see the code, and paste the correct id, that is something
like:
document.getElementById('ctl00_mainCHolder_wzLan_b olSummerHouseAddress').disabled
= false;

My question now is:
How can I (using javascrit) block a user from step foward in a Wizard
component, on asp 3.0 we added to the form tag onSubmit="return
validate(this);" and all worked fine because you could return a false and
the user had to see the problem and correct it before submit the form, unser
MasterPages I do not have access to the form element to do that, and if I
had, how could I add the javascript function to the Step Buttons?

my problem is that the page is to big (a lot of steps) and it takes a long
time to reload the page for the simple propose of show/hide a question, so
I'm trying to do this simple task using javascript.

the propose of the wizard in my page is to let users to enter a lot of data
so they could ask for a loan.

Thank you for the help.

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> escreveu na mensagem news:uqrSxahjGHA.3816@TK2MSFTNGP02.phx.gbl...[color=blue]
> Well, you can use a CompareValidator that lets you check if a value isn't
> something (or any type of operator you want).
>
> The only "trick" about getting hand-written javascript to work in .NET vs
> classic is the dynamic naming (ids) of controls. You can easily solve this
> by using a control's ClientId property:
>
> var country = document.getElementById("<%=country.ClientId %>");
>
> you'll find that this is one of the very few times most people will agree
> that you can/should use <%= in .NET
>
> Karl
>
> --
> http://www.openmymind.net/
>
>
>
> "Bruno Alexandre" <bruno.in.dk@gmail.com> wrote in message
> news:e8cT5IgjGHA.4044@TK2MSFTNGP03.phx.gbl...[color=green]
>> Using the RequiredFieldValidator I can show a message if the field is
>> empty...
>>
>> ...but How can I JUST SHOW that message if a selected value from a
>> DropDownList was previously selected?
>>
>> I really can't figure out how to use Javascript with this new framewrok
>> :-(
>>
>> ASP 3.0 was much easy :-/
>>
>> --
>>
>> Bruno Alexandre
>> (a Portuguese in Københanv, Danmark)
>>
>>[/color]
>
>[/color]


Karl Seguin [MVP]
Guest
 
Posts: n/a
#4: Jun 12 '06

re: Validation


Well, in 2.0 there's a Wizard Control. In 2.0 you also have a
ClientScritManager.RegisterOnSubmitStatement method that lets you hook into
the onSubmit event.

The best solution I can think of for 1.x is to add a client-side OnClick to
your "next" button, and return false if your validation fails. This will
prevent a postback from happening for things you can handle on the client

Karl

--
http://www.openmymind.net/
http://www.fuelindustries.com/


"Bruno Alexandre" <bruno.in.dk@gmail.com> wrote in message
news:%2397uM7hjGHA.1936@TK2MSFTNGP04.phx.gbl...[color=blue]
> but I have problems with that, because sometimes I get this error in
> javascript,
>
> document.getElementById() is nothing or is not an object...
>
> so I run the page, see the code, and paste the correct id, that is
> something like:
> document.getElementById('ctl00_mainCHolder_wzLan_b olSummerHouseAddress').disabled
> = false;
>
> My question now is:
> How can I (using javascrit) block a user from step foward in a Wizard
> component, on asp 3.0 we added to the form tag onSubmit="return
> validate(this);" and all worked fine because you could return a false and
> the user had to see the problem and correct it before submit the form,
> unser MasterPages I do not have access to the form element to do that, and
> if I had, how could I add the javascript function to the Step Buttons?
>
> my problem is that the page is to big (a lot of steps) and it takes a long
> time to reload the page for the simple propose of show/hide a question, so
> I'm trying to do this simple task using javascript.
>
> the propose of the wizard in my page is to let users to enter a lot of
> data so they could ask for a loan.
>
> Thank you for the help.
>
> --
>
> Bruno Alexandre
> (a Portuguese in Københanv, Danmark)
>
>
> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
> net> escreveu na mensagem news:uqrSxahjGHA.3816@TK2MSFTNGP02.phx.gbl...[color=green]
>> Well, you can use a CompareValidator that lets you check if a value isn't
>> something (or any type of operator you want).
>>
>> The only "trick" about getting hand-written javascript to work in .NET vs
>> classic is the dynamic naming (ids) of controls. You can easily solve
>> this by using a control's ClientId property:
>>
>> var country = document.getElementById("<%=country.ClientId %>");
>>
>> you'll find that this is one of the very few times most people will agree
>> that you can/should use <%= in .NET
>>
>> Karl
>>
>> --
>> http://www.openmymind.net/
>>
>>
>>
>> "Bruno Alexandre" <bruno.in.dk@gmail.com> wrote in message
>> news:e8cT5IgjGHA.4044@TK2MSFTNGP03.phx.gbl...[color=darkred]
>>> Using the RequiredFieldValidator I can show a message if the field is
>>> empty...
>>>
>>> ...but How can I JUST SHOW that message if a selected value from a
>>> DropDownList was previously selected?
>>>
>>> I really can't figure out how to use Javascript with this new framewrok
>>> :-(
>>>
>>> ASP 3.0 was much easy :-/
>>>
>>> --
>>>
>>> Bruno Alexandre
>>> (a Portuguese in Københanv, Danmark)
>>>
>>>[/color]
>>
>>[/color]
>
>[/color]


Bruno Alexandre
Guest
 
Posts: n/a
#5: Jun 12 '06

re: Validation


I'm using 2.0...
I upgraded from 8 years in ASP 3.0 to ASP.NET 2.0 :-)

--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> escreveu na mensagem news:uTNfEMijGHA.3496@TK2MSFTNGP02.phx.gbl...[color=blue]
> Well, in 2.0 there's a Wizard Control. In 2.0 you also have a
> ClientScritManager.RegisterOnSubmitStatement method that lets you hook
> into the onSubmit event.
>
> The best solution I can think of for 1.x is to add a client-side OnClick
> to your "next" button, and return false if your validation fails. This
> will prevent a postback from happening for things you can handle on the
> client
>
> Karl
>
> --
> http://www.openmymind.net/
> http://www.fuelindustries.com/
>
>
> "Bruno Alexandre" <bruno.in.dk@gmail.com> wrote in message
> news:%2397uM7hjGHA.1936@TK2MSFTNGP04.phx.gbl...[color=green]
>> but I have problems with that, because sometimes I get this error in
>> javascript,
>>
>> document.getElementById() is nothing or is not an object...
>>
>> so I run the page, see the code, and paste the correct id, that is
>> something like:
>> document.getElementById('ctl00_mainCHolder_wzLan_b olSummerHouseAddress').disabled
>> = false;
>>
>> My question now is:
>> How can I (using javascrit) block a user from step foward in a Wizard
>> component, on asp 3.0 we added to the form tag onSubmit="return
>> validate(this);" and all worked fine because you could return a false and
>> the user had to see the problem and correct it before submit the form,
>> unser MasterPages I do not have access to the form element to do that,
>> and if I had, how could I add the javascript function to the Step
>> Buttons?
>>
>> my problem is that the page is to big (a lot of steps) and it takes a
>> long time to reload the page for the simple propose of show/hide a
>> question, so I'm trying to do this simple task using javascript.
>>
>> the propose of the wizard in my page is to let users to enter a lot of
>> data so they could ask for a loan.
>>
>> Thank you for the help.
>>
>> --
>>
>> Bruno Alexandre
>> (a Portuguese in Københanv, Danmark)
>>
>>
>> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
>> net> escreveu na mensagem news:uqrSxahjGHA.3816@TK2MSFTNGP02.phx.gbl...[color=darkred]
>>> Well, you can use a CompareValidator that lets you check if a value
>>> isn't something (or any type of operator you want).
>>>
>>> The only "trick" about getting hand-written javascript to work in .NET
>>> vs classic is the dynamic naming (ids) of controls. You can easily solve
>>> this by using a control's ClientId property:
>>>
>>> var country = document.getElementById("<%=country.ClientId %>");
>>>
>>> you'll find that this is one of the very few times most people will
>>> agree that you can/should use <%= in .NET
>>>
>>> Karl
>>>
>>> --
>>> http://www.openmymind.net/
>>>
>>>
>>>
>>> "Bruno Alexandre" <bruno.in.dk@gmail.com> wrote in message
>>> news:e8cT5IgjGHA.4044@TK2MSFTNGP03.phx.gbl...
>>>> Using the RequiredFieldValidator I can show a message if the field is
>>>> empty...
>>>>
>>>> ...but How can I JUST SHOW that message if a selected value from a
>>>> DropDownList was previously selected?
>>>>
>>>> I really can't figure out how to use Javascript with this new framewrok
>>>> :-(
>>>>
>>>> ASP 3.0 was much easy :-/
>>>>
>>>> --
>>>>
>>>> Bruno Alexandre
>>>> (a Portuguese in Københanv, Danmark)
>>>>
>>>>
>>>
>>>[/color]
>>
>>[/color]
>
>[/color]


Bruno Alexandre
Guest
 
Posts: n/a
#6: Jun 12 '06

re: Validation


i'm on ASP.NET and exactly using the Wizard component...

even if I use ATLAS I have a lot time to reaload :(

I need the Loan Form to be simple and fast.

....and I have no Ideas except go for Flash development, but that I would
have to take a long time to see how do thinks in flash :-(


--

Bruno Alexandre
(a Portuguese in Københanv, Danmark)


"Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
net> escreveu na mensagem news:uTNfEMijGHA.3496@TK2MSFTNGP02.phx.gbl...[color=blue]
> Well, in 2.0 there's a Wizard Control. In 2.0 you also have a
> ClientScritManager.RegisterOnSubmitStatement method that lets you hook
> into the onSubmit event.
>
> The best solution I can think of for 1.x is to add a client-side OnClick
> to your "next" button, and return false if your validation fails. This
> will prevent a postback from happening for things you can handle on the
> client
>
> Karl
>
> --
> http://www.openmymind.net/
> http://www.fuelindustries.com/
>
>
> "Bruno Alexandre" <bruno.in.dk@gmail.com> wrote in message
> news:%2397uM7hjGHA.1936@TK2MSFTNGP04.phx.gbl...[color=green]
>> but I have problems with that, because sometimes I get this error in
>> javascript,
>>
>> document.getElementById() is nothing or is not an object...
>>
>> so I run the page, see the code, and paste the correct id, that is
>> something like:
>> document.getElementById('ctl00_mainCHolder_wzLan_b olSummerHouseAddress').disabled
>> = false;
>>
>> My question now is:
>> How can I (using javascrit) block a user from step foward in a Wizard
>> component, on asp 3.0 we added to the form tag onSubmit="return
>> validate(this);" and all worked fine because you could return a false and
>> the user had to see the problem and correct it before submit the form,
>> unser MasterPages I do not have access to the form element to do that,
>> and if I had, how could I add the javascript function to the Step
>> Buttons?
>>
>> my problem is that the page is to big (a lot of steps) and it takes a
>> long time to reload the page for the simple propose of show/hide a
>> question, so I'm trying to do this simple task using javascript.
>>
>> the propose of the wizard in my page is to let users to enter a lot of
>> data so they could ask for a loan.
>>
>> Thank you for the help.
>>
>> --
>>
>> Bruno Alexandre
>> (a Portuguese in Københanv, Danmark)
>>
>>
>> "Karl Seguin [MVP]" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME
>> net> escreveu na mensagem news:uqrSxahjGHA.3816@TK2MSFTNGP02.phx.gbl...[color=darkred]
>>> Well, you can use a CompareValidator that lets you check if a value
>>> isn't something (or any type of operator you want).
>>>
>>> The only "trick" about getting hand-written javascript to work in .NET
>>> vs classic is the dynamic naming (ids) of controls. You can easily solve
>>> this by using a control's ClientId property:
>>>
>>> var country = document.getElementById("<%=country.ClientId %>");
>>>
>>> you'll find that this is one of the very few times most people will
>>> agree that you can/should use <%= in .NET
>>>
>>> Karl
>>>
>>> --
>>> http://www.openmymind.net/
>>>
>>>
>>>
>>> "Bruno Alexandre" <bruno.in.dk@gmail.com> wrote in message
>>> news:e8cT5IgjGHA.4044@TK2MSFTNGP03.phx.gbl...
>>>> Using the RequiredFieldValidator I can show a message if the field is
>>>> empty...
>>>>
>>>> ...but How can I JUST SHOW that message if a selected value from a
>>>> DropDownList was previously selected?
>>>>
>>>> I really can't figure out how to use Javascript with this new framewrok
>>>> :-(
>>>>
>>>> ASP 3.0 was much easy :-/
>>>>
>>>> --
>>>>
>>>> Bruno Alexandre
>>>> (a Portuguese in Københanv, Danmark)
>>>>
>>>>
>>>
>>>[/color]
>>
>>[/color]
>
>[/color]


Closed Thread