M
MDBloemker
can anyone help me fathom out how to use this bit of code:
Public Class Utilities
Public Shared Sub CreateConfirmBox(ByRef txt As WebControls.TextBox,
_
ByVal strMessage As String)
txt.Attributes.Add("onchange", "return confirm('" & strMessage &
"');")
End Sub
End Class
invoked thusly:
Utilities.CreateConfirmBox(Me.txtDelete, "Are you sure you want to
delete (this uses the Utilities Class)?")
Works great. However....
The ever-so-helpful page I stole this from explains:
The client-side JavaScript confirm(string) function displays a confirm
message box, displaying the string message passed into the function.
Recall that confirm message boxes provide both "OK" and "Cancel"
buttons. If the "OK" button is clicked, confirm() returns true; if
"Cancel" is clicked, it returns false. The return keyword is used to
return the result of the confirm message box. If a value of false is
returned, then the form is not submitted.
What it's NOT telling me is how to get the value returned by the
javascript confirm(). I've already determined that I can't assign some
sort of flag to either the call or the class. This would be ever so
helpful if I can just figure out how to get the true/false value so
that I can handle program flow.
If the answer turns out to be blindingly obvious, I'll be very annoyed
at myself, but at the same time eternally grateful to whomsoever turns
the light on. Thanks!
MDBloemker
(e-mail address removed)
Public Class Utilities
Public Shared Sub CreateConfirmBox(ByRef txt As WebControls.TextBox,
_
ByVal strMessage As String)
txt.Attributes.Add("onchange", "return confirm('" & strMessage &
"');")
End Sub
End Class
invoked thusly:
Utilities.CreateConfirmBox(Me.txtDelete, "Are you sure you want to
delete (this uses the Utilities Class)?")
Works great. However....
The ever-so-helpful page I stole this from explains:
The client-side JavaScript confirm(string) function displays a confirm
message box, displaying the string message passed into the function.
Recall that confirm message boxes provide both "OK" and "Cancel"
buttons. If the "OK" button is clicked, confirm() returns true; if
"Cancel" is clicked, it returns false. The return keyword is used to
return the result of the confirm message box. If a value of false is
returned, then the form is not submitted.
What it's NOT telling me is how to get the value returned by the
javascript confirm(). I've already determined that I can't assign some
sort of flag to either the call or the class. This would be ever so
helpful if I can just figure out how to get the true/false value so
that I can handle program flow.
If the answer turns out to be blindingly obvious, I'll be very annoyed
at myself, but at the same time eternally grateful to whomsoever turns
the light on. Thanks!
MDBloemker
(e-mail address removed)