Welcome Guest, Not a member yet? Register   Sign In
n/a Change values in one list box based on selection in another
#8

[eluser]shades[/eluser]
Code:
[removed]
$(function(){

$('#brand_id').change(function(e){

    $.get('get_cat/'+$(this).val(), function(data) {
        var new_cat_list = ""
        for (var i=0; i<data.categoryList.length; i++)
        {
            new_cat_list += '<option value="'+data.categoryList[i].id+'">'+data.categoryList[i].name+'</option>';
        }
        $('#category_id').html(new_cat_list);
    }, 'json');

});

});  
[removed]
<div id="content" class="xfluid">
        <div class="portlet x7">
            <div class="portlet-header"><h4>Add Category</h4></div>
            <div class="portlet-content">    
                        &lt;?php echo form_open('product/add', array('class'=>'form label-inline'));?&gt;            
                            <div class="field">
                              <label for="fname">Product Name</label>
                              &lt;input id="name" name="name" size="50" type="text" class="medium" /&gt;&lt;/div>                    
                            <div class="field">
                              <label for="lname">SKU / Code No</label>
                                &lt;input id="sku" name="sku" size="50" type="text" class="medium" /&gt;&lt;/div>            
                              <div class="field"><label for="lname">Color </label>
                                &lt;input id="color" name="color" size="50" type="text" class="medium" /&gt;&lt;/div>
                                <div class="field">
                                <label for="type">Brand </label>
                                <select name="brand_id" id="brand_id" class="medium">
                                    <optgroup label="Brand Avilable">
                                        <option value="null" selected="selected">Choose Category</option>
                                            &lt;?php foreach($brandList->result() as $row): ?&gt;
                                            <option value="&lt;?=$row->id;?&gt;">&lt;?=$row->name;?&gt;</option>
                                            &lt;?php endforeach; ?&gt;                
                                    </optgroup>
                                </select>
                            </div>
                            <div class="field">
                                <label for="type">Category  </label>
                                <select name="category_id" id="category_id" class="medium">
                                    <optgroup label="Category Avilable">
                                        <option value="null" selected="selected">Choose Category</option>
                                            &lt;?php foreach($categoryList->result() as $row): ?&gt;
                                            <option value="&lt;?=$row->id;?&gt;">&lt;?=$row->name;?&gt;</option>
                                            &lt;?php endforeach; ?&gt;
                
                                    </optgroup>
                                </select>
                            </div>
                                
                              <div class="field"><label for="lname">Size </label> &lt;input id="size" name="size" size="50" type="text" class="medium" /&gt;&lt;/div>
                               <div class="field"><label for="lname">Qty </label> &lt;input id="qty" name="qty" size="50" type="text" class="medium" /&gt;&lt;/div>
                            <div class="field"><label for="lname">Unit Price </label> &lt;input id="price" name="price" size="50" type="text" class="medium" /&gt;&lt;/div>
                            
<br />
                            <div class="buttonrow">
                                <button class="btn" type="submit">Add Product</button>
                            </div>
                        &lt;/form&gt;            
            </div>
        </div>
            

        </div>

above is the view which i have made from ur code but i didnt understand that how it passes to the controller for second brand id to populate furthre


Messages In This Thread
n/a Change values in one list box based on selection in another - by El Forum - 01-01-2011, 03:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB