diff --git a/include/ajax.users.php b/include/ajax.users.php index 11b765923ddd31b65b58db3c6a69c417198d377a..01a0cdbf4ba9807f44368e8c834bd17656cd24f1 100644 --- a/include/ajax.users.php +++ b/include/ajax.users.php @@ -43,7 +43,7 @@ class UsersAjaxAPI extends AjaxController { } } - return $this->encode($users); + return $this->json_encode($users); } } diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index a858c5708089f877bdb11d1ce9d58b49375e0046..d15eb6170a9a6b02cabcdf9e4cdba0093639b534 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -22,7 +22,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); Email Address: </td> <td> - <input type="text" size="30" name="email" value="<?php echo $info['email']; ?>"> + <input type="text" size="30" name="email" id="email" class="typeahead" value="<?php echo $info['email']; ?>" + autocomplete="off" autocorrect="off" autocapitalize="off"> <span class="error">* <?php echo $errors['email']; ?></span> <?php if($cfg->notifyONNewStaffTicket()) { ?> @@ -37,7 +38,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); Full Name: </td> <td> - <input type="text" size="30" name="name" value="<?php echo $info['name']; ?>"> + <input type="text" size="30" name="name" id="name" value="<?php echo $info['name']; ?>"> <span class="error">* <?php echo $errors['name']; ?></span> </td> </tr> @@ -46,9 +47,9 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info); Phone Number: </td> <td> - <input type="text" size="18" name="phone" value="<?php echo $info['phone']; ?>"> + <input type="text" size="18" name="phone" id="phone" value="<?php echo $info['phone']; ?>"> <span class="error"> <?php echo $errors['phone']; ?></span> - Ext <input type="text" size="5" name="phone_ext" value="<?php echo $info['phone_ext']; ?>"> + Ext <input type="text" size="5" name="phone_ext" id="phone_ext" value="<?php echo $info['phone_ext']; ?>"> <span class="error"> <?php echo $errors['phone_ext']; ?></span> </td> </tr> diff --git a/scp/js/scp.js b/scp/js/scp.js index f993a5a468ea7e6d96eb3ec903b89dc4d99f2ade..08da6525eef13c66bfbfd9136a9961fdfebadcda 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -199,7 +199,7 @@ $(document).ready(function(){ } /* Typeahead init */ - $('#ticket-search').typeahead({ + $('#basic-ticket-search').typeahead({ source: function (typeahead, query) { $.ajax({ url: "ajax.php/tickets?q="+query, @@ -210,9 +210,31 @@ $(document).ready(function(){ }); }, onselect: function (obj) { - $('#ticket-search').closest('form').submit(); + $('#basic-ticket-search').val(obj.id); /*overwriting email*/ + $('#basic-ticket-search').closest('form').submit(); }, property: "value" }); + $('#email.typeahead').typeahead({ + source: function (typeahead, query) { + if(query.length > 2) { + $.ajax({ + url: "ajax.php/users?q="+query, + dataType: 'json', + success: function (data) { + typeahead.process(data); + } + }); + } + }, + onselect: function (obj) { + var fObj=$('#email.typeahead').closest('form'); + if(obj.name) + $('#name', fObj).val(obj.name); + }, + property: "email" + }); + + });