Validation

  • Thread starter Thread starter Bruno Alexandre
  • Start date Start date
B

Bruno Alexandre

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 :-/
 
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
 
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_bolSummerHouseAddress').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:[email protected]...
 
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 said:
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_bolSummerHouseAddress').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:[email protected]...
 
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:[email protected]...
 
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:[email protected]...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top