简体   繁体   中英

How to display dropdown list depends on the another dropdown option in joomla 3.x

I am new to joomla 3,Creating a custom Joomla component. I want to display the product drodown list item based on the product category dropdown list item in admin side. All data loaded from DB..I have knowledge to do it core php but i didn't have idea in joomla 3.

How can I create the custom field type for the product category list and product list, how i called the ajax function when product category list item is changed

I didn't have idea how we call the ajax file using jquery when the product category list item is changed..

For Example:

<b>Please Product catgory</b><br/>
<select name="productcat" id="productcat">
        <option value="">Select category</option>
        <option value="1">productcategory1</option>
        <option value="2">productcategory2</option>
        <option value="3">productcategory3</option>
</select>

If productcategory1 selected then i want to display product dropdown items depends productcategory1 like wise:

<select name="product" id="product">
        <option value="">choose product</option>
        <option value="1">product1</option>
        <option value="2">product2</option>
        <option value="3">product3</option>
</select>

Please any one tell the solution for it..

I have provided the jQuery Solution

      $('select#two').prop('disabled', 'disabled');
      $('select#one').change(function() {

     $('select#two').prop('disabled', false);
});

JSFIDDLE DEMO

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM