469,283 Members | 2,158 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,283 developers. It's quick & easy.

javascript confirm() and validation

hey all,

in my page load i'm attaching a javascript confirm message to my save
button. my problem is i have some client side validation which uses a Custom
Validator web control and when i make the validation go off and hit save, it
allows me to postback with the error. Am i doing something wrong?

thanks,
rodchar
Nov 21 '05 #1
5 1949
Rodchar,

What do you have the confirm script doing? Does it check validation first?
Does it submit the form itself?

The easiest way to attach a confirm to a button is to run the confirm and
then just return true or false back to the button click. That way if it
returns false it's like the button was never clicked at all.

I have a sample of doing it this way here:
http://www.aboutfortunate.com?page=javascriptdemo
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
hey all,

in my page load i'm attaching a javascript confirm message to my save
button. my problem is i have some client side validation which uses a
Custom
Validator web control and when i make the validation go off and hit save,
it
allows me to postback with the error. Am i doing something wrong?

thanks,
rodchar

Nov 21 '05 #2
Thanks for the tip. Cool Bio.
I downloaded the vs.net proj on your site. is that something i can use in my
project? if so, would it be hard for a beginner to learn?

thanks,
rodchar

"S. Justin Gengo" wrote:
Rodchar,

What do you have the confirm script doing? Does it check validation first?
Does it submit the form itself?

The easiest way to attach a confirm to a button is to run the confirm and
then just return true or false back to the button click. That way if it
returns false it's like the button was never clicked at all.

I have a sample of doing it this way here:
http://www.aboutfortunate.com?page=javascriptdemo
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
hey all,

in my page load i'm attaching a javascript confirm message to my save
button. my problem is i have some client side validation which uses a
Custom
Validator web control and when i make the validation go off and hit save,
it
allows me to postback with the error. Am i doing something wrong?

thanks,
rodchar


Nov 21 '05 #3
Please see this article for a suggested solution:
http://aspalliance.com/699#Page5

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Thanks for the tip. Cool Bio.
I downloaded the vs.net proj on your site. is that something i can use in
my
project? if so, would it be hard for a beginner to learn?

thanks,
rodchar

"S. Justin Gengo" wrote:
Rodchar,

What do you have the confirm script doing? Does it check validation
first?
Does it submit the form itself?

The easiest way to attach a confirm to a button is to run the confirm and
then just return true or false back to the button click. That way if it
returns false it's like the button was never clicked at all.

I have a sample of doing it this way here:
http://www.aboutfortunate.com?page=javascriptdemo
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
> hey all,
>
> in my page load i'm attaching a javascript confirm message to my save
> button. my problem is i have some client side validation which uses a
> Custom
> Validator web control and when i make the validation go off and hit
> save,
> it
> allows me to postback with the error. Am i doing something wrong?
>
> thanks,
> rodchar


Nov 21 '05 #4
thank you. this helped too.

"Peter Blum" wrote:
Please see this article for a suggested solution:
http://aspalliance.com/699#Page5

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Thanks for the tip. Cool Bio.
I downloaded the vs.net proj on your site. is that something i can use in
my
project? if so, would it be hard for a beginner to learn?

thanks,
rodchar

"S. Justin Gengo" wrote:
Rodchar,

What do you have the confirm script doing? Does it check validation
first?
Does it submit the form itself?

The easiest way to attach a confirm to a button is to run the confirm and
then just return true or false back to the button click. That way if it
returns false it's like the button was never clicked at all.

I have a sample of doing it this way here:
http://www.aboutfortunate.com?page=javascriptdemo
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
> hey all,
>
> in my page load i'm attaching a javascript confirm message to my save
> button. my problem is i have some client side validation which uses a
> Custom
> Validator web control and when i make the validation go off and hit
> save,
> it
> allows me to postback with the error. Am i doing something wrong?
>
> thanks,
> rodchar


Nov 21 '05 #5
Rodchar,

Thanks. The website is actually my first experiment with .Net 2003 using
controls dynamically added to one single default page. Early on I used only
post back buttons to move from one area to the next and then later I
realized that google couldn't see anything but the home page then. So I
changed the site to use the query string to control which control is loaded.

Now .Net 2005 has taken care of all of this for us. I love its master pages.
I'll be re-releasing my site (actually breaking it up into at least three
different sites) eventually.

Yes, you could just reference the entire .dll file from your application and
then use any of the methods the component contains. If you're using Visual
Studio.Net I have a help file you can download (same location as the .dlls)
that goes over each method and also contains a brief how to on referencing
the .dll. If you have any questions feel free to email me.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:79**********************************@microsof t.com...
Thanks for the tip. Cool Bio.
I downloaded the vs.net proj on your site. is that something i can use in
my
project? if so, would it be hard for a beginner to learn?

thanks,
rodchar

"S. Justin Gengo" wrote:
Rodchar,

What do you have the confirm script doing? Does it check validation
first?
Does it submit the form itself?

The easiest way to attach a confirm to a button is to run the confirm and
then just return true or false back to the button click. That way if it
returns false it's like the button was never clicked at all.

I have a sample of doing it this way here:
http://www.aboutfortunate.com?page=javascriptdemo
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"rodchar" <ro*****@discussions.microsoft.com> wrote in message
news:41**********************************@microsof t.com...
> hey all,
>
> in my page load i'm attaching a javascript confirm message to my save
> button. my problem is i have some client side validation which uses a
> Custom
> Validator web control and when i make the validation go off and hit
> save,
> it
> allows me to postback with the error. Am i doing something wrong?
>
> thanks,
> rodchar


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by GIMME | last post: by
1 post views Thread by Muhammad Abdullah | last post: by
27 posts views Thread by Chris | last post: by
6 posts views Thread by Peter Afonin | last post: by
5 posts views Thread by Peter Afonin | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.