I have created 2extra options related to tickets.
1.Product - List of products can be added.
2.AMC\Purchase Name - Purchase info related to product and company name.
which will be like product name-company name : filesigner-kale assosciates.
Everything works fine till addition and email fetching for ticket cretaion etc.
For email fetching, ticket gets created without AMC and product details as email doesnt have those mandatory fields.
So after cretaion of ticket admin\managers will edit ticket and add correct product and purchase details of that clients for that particular product.For doing this "edit ticket" has to be used.
This page has 2drop-downs :
product name :
purchase name :
When he selects a product from "product dropdown" then 2nd drop-down(purchase name) should list all AMC's\Purchases of selected product only.
So how this can be achieved?
Below is snippet of code used:
Product:
Select Product
<?
$prod= db_query('SELECT prod_id,prod_name FROM '.PRODUCT_TABLE.' ORDER BY prod_name');
if($prod && db_num_rows($prod)) {
while (list($prodId,$pname) = db_fetch_row($prod)){
$selected = ($info==$prodId)?'selected':''; ?>
"<?=$selected?>><?=$pname?>
<?
}
}?>
* <?=$errors?>
Purchase:
Select Purchase Name
<?
//Added by Deepali //
if ($thisuser->isAdmin())
$purchase= db_query('SELECT purchase_id,amc_name FROM '.PURCHASE_TABLE.' ORDER BY amc_name');
else
$purchase= db_query('SELECT purchase_id,amc_name FROM '.PURCHASE_TABLE.' WHERE dept_id='.$thisuser->getDeptId().' ORDER BY amc_name');
//Code added by Deepali ends//
if($purchase && db_num_rows($purchase)) {
while (list($purId,$pname) = db_fetch_row($purchase)){
$selected = ($info==$purId)?'selected':''; ?>
"<?=$selected?>><?=$pname?>
<?
}
}?>
* <?=$errors?>
If this is used both drop-downs list propelry but for inter-dependency how can this be achieved?
I tried to use Onchange for product as :
and function is defined as :
function showProduct(sel)
{
var value = sel.options.value;
}
But I dotn know how to handle Purchase dropdown after this.
Can anyone please help?