View Full Version : Need a little help for programming
sghubert
21-01-2009, 09:01 AM
hi all...
my qn is:
How do i make a text field appear if i select a option from the list??
For example,
Outlet : [option list (drop down menu)] < -------- there is an option call others pls specify
upon choosing others pls specify, there will be a text field that appear to let them specify
end result:
Outlet: [Others (Pls Specify)] [TEXT FIELD ( for them to sepcify)]
any php or html coding for this to happen????????
Greatly Appreciated Thanks Alot Alot
procmail
21-01-2009, 12:16 PM
hi all...
my qn is:
How do i make a text field appear if i select a option from the list??
For example,
Outlet : [option list (drop down menu)] < -------- there is an option call others pls specify
upon choosing others pls specify, there will be a text field that appear to let them specify
end result:
Outlet: [Others (Pls Specify)] [TEXT FIELD ( for them to sepcify)]
any php or html coding for this to happen????????
Greatly Appreciated Thanks Alot Alot
You can hide the textarea using CSS (style="display: none;"), then when the user clicks on the SELECT, using Javascript:
1) test if the value that was selected is "Others".
2) If yes, show the textarea.
HTH
zeroxmxi
21-01-2009, 12:20 PM
Try this.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Testing</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style type="text/css">
@media all {
body {
margin: 0.25em;
padding: 0.25em;
font-family: "Segoe UI", "Trebuchet MS", Verdana, Tahoma, sans-serif;
font-size: 12pt;
}
p {
font-family: "Segoe UI", "Trebuchet MS", Verdana, Tahoma, sans-serif;
font-size: 12pt;
line-height: 1.5em;
}
input, select, textarea {
font-family: "Segoe UI", "Trebuchet MS", Verdana, Tahoma, sans-serif;
font-size: 12pt;
}
#text1 {
display: none;
}
}
</style>
<script type="text/javascript">
<!--
function onSelect1Change() {
var select1Elem = document.getElementById("select1");
var text1Elem = document.getElementById("text1");
if (!select1Elem || !text1Elem) return;
if (select1Elem.options[select1Elem.selectedIndex].value == "Please specify:") {
text1Elem.style.display = "inline";
}
else {
text1Elem.style.display = "";
}
}
// obscured from unsupported user agents -->
</script>
</head>
<body>
<div>
<form name="form1" method="post" action="doesnotexists.php">
<select id="select1" name="select1" onchange="onSelect1Change();">
<option value="Option 1">Option 1</option>
<option value="Option 2">Option 2</option>
<option value="Option 3">Option 3</option>
<option value="Please specify:">Please specify:</option>
</select>
<input type="text" id="text1" name="text1" size="20" maxlength="200" />
</form>
</div>
</body>
</html>
Regards.
sghubert
21-01-2009, 03:54 PM
hi...can ask u... text1Elem.style.display = "inline"; <---wat does inline mean arh?
zeroxmxi
21-01-2009, 05:03 PM
hi...can ask u... text1Elem.style.display = "inline"; <---wat does inline mean arh?
http://www.w3.org/TR/CSS2/visuren.html#inline-formatting
Most HTML elements are rendered based on the inline visual format. While there are other elements which use the block visual formatting for instance your div, table, and so on.
Regards.
sghubert
21-01-2009, 05:06 PM
hhmmm... does anyone know this coding?
<script language="JavaScript">
<!--
function refreshParent() {
window.opener.location.href = window.opener.location.href;
if (window.opener.progressWindow)
{
window.opener.progressWindow.close()
}
window.close();
}
//-->
</script>
i was wondering do i need to add a trigger for this function?? and should i put this function in my parent page or pop up?
vBulletin® v3.6.8, Copyright ©2000-2010, Jelsoft Enterprises Ltd.