One Line of code confirmation on a button – visual web

Here’s one of those teeny tips that saves a lot of building screens etc. Let’s say you have a Visual Web button that you want the user to confrim before it proceeds through to the actual code at the back end.

In the onClick javascript property simply add

return confirm(“Are you sure”);

Then when the user clicks the button if they click OK the system will carry on and submit to the back end, if not, it will simply do nothing. Ofcourse we could expand this to add other messages by putting a function in some javascript in the head tags and the call it from the onClick.

Advertisements

About Paul C

I am a Senior Java programmer/Web Technologies, Play in a band called Mandolin Monday, I have a cat and I live on a boat.

Posted on March 24, 2009, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: