Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to be able to promt when a use clicks a form button, exit.

 

I want a message box to appear so that they can click ok or cancel.

 

is this possible? I see that i can use msgbox("Prompt",vbInformation,"The Title") but it doesnt seem to work what am i missing?

 

Papa.

without time nothing ever ends
Posted

where would the code that the link (and it is an excellent link) go if i want to have it called if a if() statement within the code for a button is reached?

 

that may sound like a dumb question, but the web page buttons are built on vb code and this is java code?

without time nothing ever ends
Posted

You can execute Javascript code from within the code behind

try something like this

 

 

Response.Write("<script language='javascript'>" & vbCrLf)

Response.Write("var name = confirm("Press a button")")

Response.Write("if (name == true)")

etc ....

Response.Write("</script>" & vbCrLf)

 

hope this helps

ZuBiE

Posted
You can execute Javascript code from within the code behind

try something like this

 

 

Response.Write("<script language='javascript'>" & vbCrLf)

Response.Write("var name = confirm("Press a button")")

Response.Write("if (name == true)")

etc ....

Response.Write("</script>" & vbCrLf)

 

hope this helps

ZuBiE

 

ultimately what i want is for a button to be pressed on a web form - EXIT - and then a message box to pop up, with Save? YES - NO - Cancel.

 

 

Or something similar...all the java solutions dont seem to cover this. If this is not possible, just a click EXIT then msgbox appear would good.

without time nothing ever ends
  • *Experts*
Posted (edited)

You can add a little bit of JavaScript to a button that pops up a

dialog with OK or Cancel. If the user clicks OK, the code for the

button executes. Otherwise, nothing happens.

 

This code can go in the Page.Load event or any code that

executes before the page finished loading, where myButton is

the name of the button control:

myButton.Attributes.Add("onClick", "java[b][/b]script:return confirm('Would you like to exit?')";

 

Anyway, is that what you're looking for?

 

[edit]To avoid confusion, I've fixed the 'javascript' bit. -VolteFace[/edit]

Edited by Volte

"Being grown up isn't half as fun as growing up

These are the best days of our lives"

-The Ataris, In This Diary

Posted

try this

 

This is java script

function name()

{

var flag=window.confirm("Are you sure you want to Exit");

if (flag)

{

window.document.formname.submit();

}

else

{

return false;

}

}

 

call this function from ur submit button

Posted

thanks for all the posts.

 

Unfortunately it seems that it is not possible to have a message box that has mutiple options.

 

E.g.

 

---------------------------------

| Save? |

| |

| Yes - No - Cancel |

---------------------------------

 

Papa.

without time nothing ever ends
Posted

The way that i intended that message box be used...

 

The user has informaiton on the web form. This information they can change, once they have made there changes they would press exit. The exit buttong would bring up the message box option...

 

Do you accept this information as true?

 

Yes - would call a function and pass the information on one way.

 

No - would call a funtion pass the information on another way.

 

Cancel - would allow them to edit the information on the web page again.

without time nothing ever ends

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...