How to validate with two separate "forms" on the page?

A

Alan Silver

Hello,

I have a page that displays a data list with info from a database. The
grid has the usual stuff, edit, update, delete etc. Below this I have a
section where they can add a new entry to the list. This has some text
boxes for the data, and a button to click when they are ready to submit.

To the user, this looks like two separate forms, one containing a grid
of existing data and one where they add new data.

Trouble is, if they click the "edit" link button in the grid, nothing
happens as the validator on one of the text boxes in the new entry
section claims that it needs a value. Truth is, it does need a value,
but only when they are adding a new entry.

So how do I stop the validator firing when they click on the "edit"
link? I only want it to fire when they click the button to add a new
entry.

TIA
 
S

Scott Allen

One of the drawbacks to validation in 1.x is that all of the
validators fire every time unless you go through and disable the ones
you don't need. So, it takes some bruce force, unfortunately.

There are third party validation controls that are a lot smarter than
the ones in 1.x.

2.0 supports 'validation groups' but that is not a lot of help at this
time!
 
A

Alan Silver

One of the drawbacks to validation in 1.x is that all of the
validators fire every time unless you go through and disable the ones
you don't need. So, it takes some bruce force, unfortunately.

How can I do that? When the server sends out the page, it doesn't know
if the user is going to fill in the new entry form, or click the "edit"
linkbutton. The client-side validation fires, preventing the page from
being posted back to the server.

Any suggestions? Thanks for the reply
 
S

Scott Allen

How can I do that? When the server sends out the page, it doesn't know
if the user is going to fill in the new entry form, or click the "edit"
linkbutton. The client-side validation fires, preventing the page from
being posted back to the server.

Peter Blum's controls are highly recommended:
http://www.peterblum.com/vam/home.aspx

Another solution is to disable client side validation and enable /
disable on the server, along the lines of:
http://www.codeproject.com/aspnet/groupvalidator.asp

HTH,
 
A

Alan Silver

One of the drawbacks to validation in 1.x is that all of the
Peter Blum's controls are highly recommended:
http://www.peterblum.com/vam/home.aspx

Wow, they look good. Have you used these? I can see that a few of those
would be very useful, but I'd like to know if they are as good as they
look.
Another solution is to disable client side validation and enable /
disable on the server, along the lines of:
http://www.codeproject.com/aspnet/groupvalidator.asp

That's clever!! I'll have a closer look at that as it seems to do what I
want quite simply.

Thanks for the reply.
 
S

Scott Allen

Peter Blum's controls are highly recommended:
Wow, they look good. Have you used these? I can see that a few of those
would be very useful, but I'd like to know if they are as good as they
look.

Personally I have not - but people I know are very happy with them,
and say not only is the software solid but the support and
documentation are excellent also.
 
A

Alan Silver

Peter Blum's controls are highly recommended:
Personally I have not - but people I know are very happy with them,
and say not only is the software solid but the support and
documentation are excellent also.

Thanks. For $50 per set, they seem quite reasonable. Glad to hear people
like them. Maybe I'll download a trial.
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top