PDA

View Full Version : custom new ticket


jpowers40828
02-11-2008, 11:19 PM
I modified my client/open.inc.php so that the names are in a drop down. Sometime after selecting their name from the drop down, I would like to have the email address filled in automatically. If anyone is able to point me in the right direction, that would be great. Thanks in advance.

4ice
02-12-2008, 04:15 AM
I have no idea how you have done this (could be in several ways) so giving an answer is not very easy. However you can try to look into using Javascript and or AJAX.

Perhaps more info would be nice.

jpowers40828
02-15-2008, 05:02 PM
<?php
if(!defined('OSTCLIENTINC')) die('Kwaheri rafiki wangu?'); //Say bye to our friend..

$info=($_POST && $errors)?Format::htmlchars($_POST):array(); //on error...use the post data
?>
<div>
<?if($errors['err']) {?>
<p align="center" id="errormessage"><?=$errors['err']?></p>
<?}elseif($msg) {?>
<p align="center" id="infomessage"><?=$msg?></p>
<?}elseif($warn) {?>
<p id="warnmessage"><?=$warn?></p>
<?}?>
</div>
<div>Please fill in the form below to open a new ticket.</div><br>
<form action="open.php" method="POST" enctype="multipart/form-data">
<table align="left" cellpadding=2 cellspacing=1 width="90%">
<tr>
<th width="20%">Full Name:</th>
<td>
<select name="name">

<option value="0" selected="selected">Select One</option>

<?$services= db_query('SELECT firstname,lastname,email,phone FROM '.STAFF_TABLE.' WHERE isactive=1 ORDER BY firstname');

while (list($firstname,$lastname,$emailtmp,$phonetmp) = db_fetch_row($services)){?>

<option value="<?=$firstname?> <?=$lastname?>"><?=$firstname?> <?=$lastname?></option>

<?}?>
</select>
</td>
</tr>
<tr>
<th nowrap >Email Address:</th>
<td>
<?if ($thisclient && ($email=$thisclient->getEmail())) {
?>
<input type="hidden" name="email" size="25" value="<?=$email?>"><?=$email?>
<?}else {?>
<input type="text" name="email" size="25" value="<?=$info['email']?>">
<?}?>
&nbsp;<font class="error">*&nbsp;<?=$errors['email']?></font>
</td>
</tr>
<tr height=2px><td align="left" colspan=2 ></td></tr>
<tr>
<th>Help Topic: </th>
<td>
<select name="topicId">
<?
$services= db_query('SELECT topic_id,topic FROM '.TOPIC_TABLE.' WHERE isactive=1 ORDER BY topic');
while (list($topicId,$topic) = db_fetch_row($services)){
$selected = ($info['topicId']==$topicId)?'selected':''; ?>
<option value="<?=$topicId?>"<?=$selected?>><?=$topic?></option>
<?
}?>
</select>
&nbsp;<font class="error">*&nbsp;<?=$errors['topicId']?></font>
</td>
</tr>
<tr>
<th>Subject:</th>
<td>
<input type="text" name="subject" size="35" value="<?=$info['subject']?>">
&nbsp;<font class="error">*&nbsp;<?=$errors['subject']?></font>
</td>
</tr>
<tr>
<th valign="top">Message:</th>
<td>
<? if($errors['message']) {?> <font class="error"><b>&nbsp;<?=$errors['message']?></b></font><br/><?}?>
<textarea name="message" cols="35" rows="8" wrap="soft" style="width:85%"><?=$info['message']?></textarea></td>
</tr>
<?
if($cfg->allowPriorityChange() ) {
$sql='SELECT priority_id,priority_desc FROM '.TICKET_PRIORITY_TABLE.' WHERE ispublic=1 ORDER BY priority_urgency DESC';
if(($priorities=db_query($sql)) && db_num_rows($priorities)){ ?>
<tr>
<th>Priority:</th>
<td>
<select name="pri">
<?
while($row=db_fetch_array($priorities)){ ?>
<option value="<?=$row['priority_id']?>" <?=$info['pri']==$row['priority_id']?'selected':''?> ><?=$row['priority_desc']?></option>
<?}?>
</select>
</td>
</tr>
<? }
}?>

<?if(($cfg->allowOnlineAttachments() && !$cfg->allowAttachmentsOnlogin())
|| ($cfg->allowAttachmentsOnlogin() && ($thisclient && $thisclient->isValid()))){

?>
<tr>
<th>Attachment:</th>
<td>
<input type="file" name="attachment"><font class="error">&nbsp;<?=$errors['attachment']?></font>
</td>
</tr>
<?}?>
<tr height=2px><td align="left" colspan=2 >&nbsp;</td></tr>
<tr>
<td></td>
<td>
<input class="button" type="submit" name="submit_x" value="Open Ticket">
<input class="button" type="reset" value="Reset">
<input class="button" type="button" name="cancel" value="Cancel" onClick='window.location.href="index.php"'>
</td>
</tr>
</table>
</form>