neverett Posted February 29, 2008 Share Posted February 29, 2008 Here's what I'm trying to do. I have a select list in an HTML form (in a PHP file). If a person selects 2 for instance, I want a new table row to appear and a textarea to appear in that row. If a person deselects 2, the new row and textarea should disappear. I was planning on using onchange, but I'm up for using javascript if that is more efficient. Also, if the person selects 2, the row and textarea appear, I'd like to automatically put the cursor in the textarea. Hope that makes sense. If anyone has any suggestions, I would like to thank you in advance. Thanks! Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 29, 2008 Share Posted February 29, 2008 Is this a regular or multiple select list? Quote Link to comment Share on other sites More sharing options...
neverett Posted February 29, 2008 Author Share Posted February 29, 2008 Just a regular list. The user will only be able to select one item. Quote Link to comment Share on other sites More sharing options...
rhodesa Posted February 29, 2008 Share Posted February 29, 2008 Something like this? <select onclick="document.getElementById('mytextarea').style.display=(this.value)?'':'none';"> <option value="" selected>--Select an option--</option> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3">Option 3</option> <option value="option4">Option 4</option> <option value="option5">Option 5</option> </select> <br> <textarea id="mytextarea" name="name" style="display:none;"></textarea> Quote Link to comment Share on other sites More sharing options...
neverett Posted March 1, 2008 Author Share Posted March 1, 2008 I can get that to work just fine. One last question though. How can I get a similar idea to work only this time to display a table row that contains that textarea? Basically, if item option2 is selected (clicked), then I want a table row to be displayed that contains that textarea. Hope that makes sense! Thanks for all your help! Quote Link to comment Share on other sites More sharing options...
neverett Posted March 2, 2008 Author Share Posted March 2, 2008 Can anyone help? If I should elaborate more, please tell me. Thanks! Quote Link to comment Share on other sites More sharing options...
neverett Posted March 4, 2008 Author Share Posted March 4, 2008 Solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.