Link to home
Create AccountLog in
Avatar of ankuratvb
ankuratvbFlag for United States of America

asked on

Get Prompt Result in Server Side Code

Hi,

This is what i need.

I have a webform.When the user clicks a button,i need to ask the user for a value which i use for
furthur processing.

I need some way to get the value from the user and use it in my server side code. I tried using
InputBox but it gives me an error saying that to use inputbox i need to have a modal application
or use a service(smoething along these lines).

So,i tried using javascript's window.prompt and then trigger the server side event by generating a
button click when the user has entered a value.
So,i do:
perc=window.prompt("Enter Percentage Value:")
document.Form1.txtval.value=perc;
document.Form1.btn.click();

but the click statement gives me an error saying contentWindow.document is null or not an object.
i tried using Form1.btn.click() but still doesnt work.
If i remove the click statement, then the value is put in the textbox but i need an event to be triggered
to process furthur.

Can you help me in doing this?
Any Help would be greatly appreciated.
Thanx.
Avatar of Hamed Zaghaghi
Hamed Zaghaghi
Flag of Iran, Islamic Republic of image

hi,

if you want to get a confirmation from the user, for example you want to ask the user that does he/she want to delete an Item?

so you can write a java script function that return a boolean value, and in this function you call the prompt, and if user say Yes to prompt, return true, and else return false;

and then in the button tag in html view write this function on 'onclick' event of the button
for example:
<.......         onclick="functionname()" >

have good programming day;
--hamed
Avatar of ankuratvb

ASKER

What i need is the user to enter a value which i have to store in a database.

For e.g. i ask him for a number and i store the number in the database
ASKER CERTIFIED SOLUTION
Avatar of boulder_bum
boulder_bum

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account