dimple Posted October 7, 2009 Share Posted October 7, 2009 hi, i have a combo box & 2 text box on my form for example: <form id="form1" name="form1" method="post" action=""> <select name="payment_mode" id="payment_mode"> <option value="cash">Cash</option> <option value="cheque">Cheque</option> <option value="credit card">Credit Card</option> </select> <input type="text" name="cheque no." id="cheque no." /> <input type="text" name="bank_name" id="bank_name" /> Now I want to hide those text box when the selected value from combo is cash. It works with the submit button but i dnt want to use submit button. How to i determine the selected value of list without submission of form. Link to comment https://forums.phpfreaks.com/topic/176800-solved-help-me-on-dis-topic/ Share on other sites More sharing options...
btherl Posted October 7, 2009 Share Posted October 7, 2009 You need to use javascript. If you also require information from the server when an option is selected then you need ajax, but from what you've said, you just need plain javascript. Keep in mind that values can still be submitted even if they are not visible. Link to comment https://forums.phpfreaks.com/topic/176800-solved-help-me-on-dis-topic/#findComment-932174 Share on other sites More sharing options...
dimple Posted October 7, 2009 Author Share Posted October 7, 2009 i dnt knw javascript , so can u provide me some code Link to comment https://forums.phpfreaks.com/topic/176800-solved-help-me-on-dis-topic/#findComment-932178 Share on other sites More sharing options...
btherl Posted October 7, 2009 Share Posted October 7, 2009 Look for "javascript tutorial" or "javascript hide form elements" and you'll find some guides and sample code, as well as other people asking the same question as you are. Link to comment https://forums.phpfreaks.com/topic/176800-solved-help-me-on-dis-topic/#findComment-932182 Share on other sites More sharing options...
dimple Posted October 7, 2009 Author Share Posted October 7, 2009 hey thanx, i found its solution. Link to comment https://forums.phpfreaks.com/topic/176800-solved-help-me-on-dis-topic/#findComment-932189 Share on other sites More sharing options...
dimple Posted October 7, 2009 Author Share Posted October 7, 2009 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <!--Make an HTML page and place this script inside the HEAD tag:--> <script language="JavaScript"> function showhidefield() { if (document.frm.chkbox.checked) { document.getElementById("hideablearea").style.visibility = "visible"; } else { document.getElementById("hideablearea").style.visibility = "hidden"; } } </script> </head> <body> <!--Put the following code inside the BODY tag:--> <form name='frm' action=''> <input type="checkbox" name="chkbox" onclick="showhidefield()"> <!-- Check/uncheck here to show/hide the other form fields--> <br> <div id='hideablearea' style='visibility:hidden;'> <input type='text'><br> <input type='submit'> </div> <!-- This is a text line below the hideable form fields.--> <br> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/176800-solved-help-me-on-dis-topic/#findComment-932190 Share on other sites More sharing options...
dimple Posted October 7, 2009 Author Share Posted October 7, 2009 http://www.phpfreaks.com/forums/index.php/topic,118755.0.html Link to comment https://forums.phpfreaks.com/topic/176800-solved-help-me-on-dis-topic/#findComment-932191 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.