saravanataee Posted December 29, 2012 Share Posted December 29, 2012 Dear Members, I have a doubt. I am having a table with three fields ItemName,Packing,Quantity. Each item has list of Packing's like Small,Medium,Large. And Each packing has size like 50,100,200. When i select ItemName from Combo1, My Combo2 Packing should be showing what all packs for that particualr item available and then show the size of that particular pack in textfield. In php form: ItemName: combo1 Packing: combo2 Quantity: textbox1 when combo1 selected values of combo2 must be changed based on combo1 selection. when combo2 has particular pack, textbox should display only quantity defined for that particular pack.. Can anyone suggest me how can proceed on this .. I knwo javascript is the only way. But i m not expert in it. referr me to some demo or example or piece of code from where i can get idea.. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/272479-filling-text-box-based-on-comboselected-value/ Share on other sites More sharing options...
sowna Posted December 29, 2012 Share Posted December 29, 2012 You can use ajax for this....call ajax when first combo1 is selected and based on this value fill the second combo... Again call ajax for the second combo and fill the value in the textbox based on the name you selected in the combo box... You will get many sample by searching google (populating dropdown using php/mysql) or refer below url http://buffernow.com/demo/cascadedrpdwn/ Quote Link to comment https://forums.phpfreaks.com/topic/272479-filling-text-box-based-on-comboselected-value/#findComment-1401982 Share on other sites More sharing options...
saravanataee Posted December 29, 2012 Author Share Posted December 29, 2012 Hi Sowna, The example link you have given is awesome. It is exactly similar to what i have been looking for, but only change is that i needed a text box instead of third combo box. Anyway, Can i get some sample code for such ajax call usage. Becuz i have not done that before. Since no idea on how to proceed further. If you provide me some example code, it will be great full. Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/272479-filling-text-box-based-on-comboselected-value/#findComment-1401989 Share on other sites More sharing options...
sowna Posted January 25, 2013 Share Posted January 25, 2013 (edited) Just replace combo box with text field...and modify the code as per your requirement... Edited January 25, 2013 by sowna Quote Link to comment https://forums.phpfreaks.com/topic/272479-filling-text-box-based-on-comboselected-value/#findComment-1408101 Share on other sites More sharing options...
SalientAnimal Posted January 25, 2013 Share Posted January 25, 2013 The other thing that you can use here is a multiple drop-down box. This uses a validation to check the current selected value to then populate the next list. I did this a while ago and was able to have multiple drop-downs all populating based on the previous selection. Quote Link to comment https://forums.phpfreaks.com/topic/272479-filling-text-box-based-on-comboselected-value/#findComment-1408120 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.