mubeensamoon Posted June 5, 2015 Share Posted June 5, 2015 I have a drop down menu with a few options and I want to enable the selected portion and disable the other portions once I select a value from dropdown using PHP. Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/ Share on other sites More sharing options...
.josh Posted June 5, 2015 Share Posted June 5, 2015 you can't do this with php. use javascript. Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/#findComment-1513216 Share on other sites More sharing options...
requinix Posted June 5, 2015 Share Posted June 5, 2015 Moved. Are you sure you want to use a dropdown for after they've made their selection? It's not like they can change it anymore. I suggest you reconsider whether you want to prevent the user from changing their mind, or else use Javascript to change the input entirely - like from a dropdown to a hidden input and plain text. <select name="foo"> <option value="value1">Option 1</option> <option value="value2">Option 2</option> </select> <input type="hidden" name="foo" value="value1"> Option 1 Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/#findComment-1513223 Share on other sites More sharing options...
mubeensamoon Posted June 5, 2015 Author Share Posted June 5, 2015 Can you help me to write javascript for the above? And also let me know the below query I have two buttons namely "Submit" and "Add" in a web page. I want to disable submit button if I click on Add and vice versa. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/#findComment-1513225 Share on other sites More sharing options...
requinix Posted June 5, 2015 Share Posted June 5, 2015 What's the difference between "Submit" and "Add"? The former is just a generic term and the latter implies a specific sort of action. Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/#findComment-1513240 Share on other sites More sharing options...
mubeensamoon Posted June 8, 2015 Author Share Posted June 8, 2015 Add will upload the selected file to the application and Submit will add the user entered text in the application. I need to disable one if the other one is selected. Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/#findComment-1513459 Share on other sites More sharing options...
requinix Posted June 8, 2015 Share Posted June 8, 2015 Use two forms. Besides the fact that having those two buttons on the same form would be confusing, if someone chooses a file to upload and then hits Submit, the file still gets uploaded. If you use two separate forms then you avoid that. Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/#findComment-1513490 Share on other sites More sharing options...
mubeensamoon Posted June 9, 2015 Author Share Posted June 9, 2015 (edited) Hi Form 1 <?php $this->renderPartial('_form', array('modelRebate'=>$modelRebate,'modelUploadAnn'=>$modelUploadAnn)); ?> <h3>File Uploader</h3> Form 2 <?php //Defining the modelUploadedImage $modelUploadAnn->file_prf = $modelRebate->rebate_prf; $this->renderPartial('/files/uploadAnn',array('modelUploadAnn'=> $modelUploadAnn)); ?> I am using the above two forms for the buttons but I am not able to arrive at the answer. How to disable the one when the other one is selected.??? Edited June 9, 2015 by mubeensamoon Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/#findComment-1513502 Share on other sites More sharing options...
mubeensamoon Posted June 17, 2015 Author Share Posted June 17, 2015 @Anemic Moderator : Please help me Quote Link to comment https://forums.phpfreaks.com/topic/296649-i-want-to-disable-it-as-soon-as-a-value-from-dropdown-has-been-selected/#findComment-1514137 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.