To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-27-2006, 07:24 PM   #1
jbachris
Senior Member
 
Join Date: Jan 2005
Posts: 165
PHP and Javascript related

I think this can be done with javascript.

I have a job listings manager I've built. When a person logs in to edit one of the job postings I need some help. Right now I've got the following code to edit the type of job:

Code:
<tr>
     <td align="left"><b><font face="Tahoma, Verdana, Arial, Helvetica, sans-serif" color="#000000" size="1">Type: </font></b></td>
     <td align="left"><input size="50" maxlength="150" type="text" name="type" value="<?php echo $row->type; ?>"></td></tr>
What I would like to do is put a <select> box in the row below this, where the user can select the "type" from the drop-down list and when they select one, it automatically updates the <input name="type"> box.

Thanks for any help!
jbachris is offline   Reply With Quote
Old 04-27-2006, 07:53 PM   #2
zeb
Senior Member
 
Join Date: Jun 2003
Location: Maine
Posts: 119
Try this:

Code:
<input size="50" maxlength="150" type="text" name="type" value="<?php echo $row->type; ?>"><br>
<br>
<select name='filler2' onchange="document.formName.elements['type'].value = this.options[this.selectedIndex].value;">
	<option value='1'>job type 1</option>
	<option value='2'>job type 2</option>
</select>
__________________
..:: Zeb ::..

zebellis.com
zeb is offline   Reply With Quote
Old 04-27-2006, 08:01 PM   #3
Naito
Member
 
Join Date: Apr 2006
Posts: 33
Another option/example would be.

Quote:
<html>
<head>
<title>Test</title>
</head>
<body>

<script type="text/javascript">
function changename(select) {
document.form1.name1.value = select;
}
</script>

<form name="form1" method="POST" enctype=application/x-www-form-urlencoded>
Enter Name Here: &nbsp;
<input name="name1" type="INT" size="30" value=""><br>
<select size="1" name="cname" onChange="changename(this.value)">
<option value="">Please Select A Value</option>
<option value="John">John</option>
<option value="Amy">Amy</option>
</select>


</body>
</html>
Naito is offline   Reply With Quote
Old 04-27-2006, 08:07 PM   #4
Naito
Member
 
Join Date: Apr 2006
Posts: 33
Also note that if you would rather forget the function part of the script you could do onChange="document.form1.name1.value = this.value" Instead of the current onChange and throw out the whole <script></script> lines. It just seems a bit more tidy when it's part of a function.
Naito is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:10 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.