Wrox Programmer Forums
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 7th, 2003, 12:20 AM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default List box in prompt box

I successfully pop up a prompt box if the user clicked the selected radio button
and display the entered data in the text box.
I would like to know can i make the prompt box to have list box?
I want the prompt box to let user select a value rather than typing it in the prompt box. Is this possible?

<HTML>
<HEAD>
<script type="text/javascript">
function funct1()
{
    var name = prompt("Please enter productID", "");
    if ((name != null) && (name != ""))
    {
        document.form1.text1.value = name;
    }
}
</script>
</HEAD>

<BODY>
<form name="form1">
<input type="radio" name="radio1" value="one" >one
<input type="radio" name="radio1" value="two" onclick="funct1()">two
<input type="radio" name="radio1" value="three" onclick="funct1()">three

<input type="text" name="text1" value="name">
</form1>
</BODY>
</HTML>

 
Old December 7th, 2003, 05:55 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

No, not directly. The only two options you have are the alert box and the prompt / input box.


What you could do is open a new browser Window using JavaScript (window.open). The new window should be sized s it looks like an input dialog. (You won't be able to resize it to anything smaller than 100 x 100 due to security restrictions). Then you can return a value from that new window, or use some JavaScript to add the selected value to the parent form.

Does that make sense?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 7th, 2003, 06:12 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Or have a div that is normally hidden appear when they choose the radio button. It will be quicker and less resource hungry than opening a fresh window.

--

Joe
 
Old December 8th, 2003, 04:18 AM
Authorized User
 
Join Date: Oct 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok.i'll have a try and tell ya what is the result.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Grab Values From List Box into Text Box phungleon VB How-To 2 June 19th, 2008 10:33 PM
multi-column list box values moved to 2nd list box sbmvr Access VBA 1 May 14th, 2007 01:58 PM
select box/List box alphabetic sort sasidhar79 Javascript How-To 3 November 10th, 2004 03:04 AM
Populate List Box by Combo Box Selection mmcdonal Access 2 June 15th, 2004 12:08 PM
Search using drop down list box and a text box tcasp Classic ASP Basics 1 July 31st, 2003 02:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.