这是HTML代码我已经使用下拉形式...
/addProduct命令”是enctype = '的multipart/form-data的'>
<fieldset>
<legend>Category Information</legend>
<div class="required">
<label for="category">Main Category
<font color="red" title="This field is required for registration.">*</font></label>
<?php if(isset($merchantData->membership_package) && $merchantData->membership_package==2)
$categoryId=1;
if(isset($categoryId) && $categoryId!='')
$whereCondition="category_id='".$categoryId."' && is_active='1' && parent_id='0' order by category_name";
else
$whereCondition="is_active='1' && parent_id='0' order by category_name";
?>
<?php
echo $obj_category->selectBox('cat_id', 'Select Category', 'category_id', 'category_name', isset($cat_id) ? $cat_id :"",$whereCondition, 'class="validate[required]"');
?>
<div class="clear"></div>
<small>Please select the best combination of category and sub-categories for your product</small>
</div>
<div class="required">
<label for="sub_category">Sub Category<font color="red" title="This field is required for registration.">*</font></label>
<?php
if (isset($cat_id) && !empty($cat_id)) {
echo $obj_category->selectBox('subcat_id', 'Select Sub Category', 'category_id', 'category_name',
isset($ subcat_id)? $ subcat_id:'',“is_active ='1'和parent_id ='”。 $ cat_id。 “'order by category_name”,'class =“validate [required]”');
} else {
?>
<select name="subcat_id" id="subcat_id" title="Sub Category" class="validate[required]">
<option>Select Sub Category</option>
</select>
<?php } ?>
<div class="required">
<label for="sub_sub_category">Sub Sub Category<font color="red" title="This field is required for registration.">*</font></label>
<?php
if (isset($subcat_id) && !empty($subcat_id)) {
echo $obj_category->selectBox('subsubcat_id', 'Select Sub Sub Category', 'category_id', 'category_name', isset($subsubcat_id) ? $subsubcat_id : '', "is_active = '1' and parent_id ='" . $subcat_id . "' order by category_name", 'class="validate[required]"');
} else {
?>
<select name="subsubcat_id" id="subsubcat_id" title="Sub Sub Category" class="validate[required]">
<option>Select Sub Sub Category</option>
</select>
<?php } ?>
</div>
</fieldset>
来源
2014-10-20 15:58:53
sam
感谢您的答复。我试过这个,但它不工作。 cat_id不会改变,它仍然接收空值。如果cat_id被改变,那么只有改变函数才会被触发。我不知道该怎么做...... – sam 2014-10-20 15:34:20
你能发布你的html吗?更改功能是不是你想要触发的唯一的事情? – 2014-10-20 15:40:06
我想在更改cat_id时触发更改功能。但是,当我选择主类别值时,cat_id没有收到任何值。 – sam 2014-10-20 19:54:36