Jump to content


Filling Text Box Based On Comboselected Value!

  • Please log in to reply
4 replies to this topic

#1 saravanataee



  • Members
  • PipPip
  • 25 posts

Posted 29 December 2012 - 04:22 AM

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..


#2 sowna



  • Members
  • PipPip
  • 29 posts

Posted 29 December 2012 - 04:56 AM

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


#3 saravanataee



  • Members
  • PipPip
  • 25 posts

Posted 29 December 2012 - 06:04 AM

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.


#4 sowna



  • Members
  • PipPip
  • 29 posts

Posted 25 January 2013 - 12:12 AM

Just replace combo box with text field...and modify the code as per your requirement...

Edited by sowna, 25 January 2013 - 12:13 AM.

#5 SalientAnimal


    Advanced Member

  • Members
  • PipPipPip
  • 331 posts

Posted 25 January 2013 - 03:48 AM

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime