r-it Posted May 3, 2007 Share Posted May 3, 2007 i have a problem, i would like to be able to change the state of a textbox and what is in it according to the dropdown selection. Please have a look at the attached image to see what i want to explain. This is a relationship form, so basically, i want to add the type of relationships tht can exist between 2 entities. By default, the 2 entity textboxes are disabled. when the user clicks the 1st dropdown and they dont find the item they are looking for, they can add a new entity, and this should enable the New entity textbox underneath it, then the user can enter it there, same goes for the second dropdown. The other thing is, if the item is in the dropdown and they make a selection, the text should automatically be populated in the textbox below it, this is all without a server call, i mean without having to reload the page. I've seen it somewhere in javascript, but i searched for a similar examples in the forums, but i just can't find it anywhere, please help if you can, and please don't tell me to use ajax, i think this is just simple javascript [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/49770-solved-php-and-javascript-again/ Share on other sites More sharing options...
jitesh Posted May 3, 2007 Share Posted May 3, 2007 <script language="javascript"> function set(value){ if(value == 'addnew'){ document.getElementById('newrel').disabled = false; }else{ document.getElementById('newrel').value = value; } } </script> <select name="relation" onchange="javascript:set(this.value);"> <option>Select relation</option> <option value="addnew">addnew</option> <option value="manager">manager</option> <option value="teamleader">team leader</option> </select> <input type="text" disabled name="newrel" id="newrel"/> Link to comment https://forums.phpfreaks.com/topic/49770-solved-php-and-javascript-again/#findComment-244132 Share on other sites More sharing options...
r-it Posted May 3, 2007 Author Share Posted May 3, 2007 @jitesh, l337 dude, thanx a lot Link to comment https://forums.phpfreaks.com/topic/49770-solved-php-and-javascript-again/#findComment-244137 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.