Link to home
Start Free TrialLog in
Avatar of one2goofy
one2goofy

asked on

JavaScript alert with input field

Hi Experts,

Is there away to put an input field in an alert box, or some type of message box, and then verify if information has been entered before continuing to the page that updates the db?

I have a menu option, text link, when selected I want an alert box to pop and asks for a date to be entered in the input field - then verify a valid date has been entered before continuing to the asp page that updates my SQL server db.

If this can't be done in JavaScript can it be done in asp?

Thanks!
Avatar of viola123
viola123

hi,

unfortunately, alert box is a built-in function. it is impossible to add a text field in alert message box.

i am suggesting you implementing a text field and button in a <div> layer and then toggle the visibility of this <div.layer via your menu option.

cheers
viola
Avatar of one2goofy

ASKER

Is there any other way to pop up a box?  If not an alert any other message box that allows input fields?
You can always create your own pop-up windows (given the user doesn't have pop-up blocking ;)

http://www.htmlcodetutorial.com/linking/linking_famsupp_72.html
hi,

i don't think there is any way to append a text field in a message box.

however, another normal walk-around is to create a small centralized window, which is able to hold your textbox and button.

eg.
if (confirm("Proceed?")) {
           window.location = "newStatusPage.html";
           newWindow =   window.open("http://www.google.com", "newWindow", "height=400, width=400");      
           newWindow.focus();
}

good luck

viola
ASKER CERTIFIED SOLUTION
Avatar of pmsyyz
pmsyyz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
pmsyyz,

good idea, but do you have any way to customize the promp box further? it yes, that would be great for one2goofy


viola
No, you can't really customize it, the most you can do is add newlines (\n) to your message text.

For more format control I would use a text INPUT in a DIV with a higher z-index than the page and style it with CSS.