Link to home
Create AccountLog in
Avatar of allelopath
allelopath

asked on

Confirm -> OK

In the vb.net codebehind, I have this:
ClientScript.RegisterStartupScript(Me.GetType(),
                                                          "LocError",
                                                  "<script language='javascript'>if (confirm('Continue?')) {document.getElementById('Updates').value = 'true';}</script> ")

Open in new window

which displays a confirm dialog. I want it to set the value of the hidden field "Updates" if the user clicks OK. It is not working, however, the values is not being set. Is the javascript correct?
Avatar of Manuel Marienne-Duchêne
Manuel Marienne-Duchêne
Flag of France image

What type of Updates Form
Avatar of allelopath
allelopath

ASKER

There is my problem. I need to submit the form after the hidden variable is set. I just tried this:
"<script language='javascript'> document.getElementById('txReceiptID').focus(); document.getElementById('txReceiptID').select(); document.forms.Form1.submit();</script> ")

Open in new window

but that leads to erratic behavior
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer