Skip to content
Snippets Groups Projects
Commit a576e5ae authored by Jared Hancock's avatar Jared Hancock
Browse files

ui: Make autofocused fields declarative

Instead of selecting the first enabled, visible, non datepicker field, just
use the new @autofucus HTML5 attribute to automatically select the
autofocused field
parent c9e6ba18
Branches
Tags
No related merge requests found
Showing
with 35 additions and 25 deletions
......@@ -70,7 +70,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
</td>
<td>
<span>
<input type="text" size="30" name="ipaddr" value="<?php echo $info['ipaddr']; ?>">
<input type="text" size="30" name="ipaddr" value="<?php echo $info['ipaddr']; ?>"i
autofocus>
&nbsp;<span class="error">*&nbsp;<?php echo $errors['ipaddr']; ?></span>
<i class="help-tip icon-question-sign" href="#ip_addr"></i>
</span>
......
......@@ -55,8 +55,9 @@ $query="$select $from $where ORDER BY $order_by LIMIT ".$pageNav->getStart().","
<form action="banlist.php" method="GET" name="filter">
<input type="hidden" name="a" value="filter" >
<div>
<?php echo __('Query');?>: <input name="q" type="text" size="20" value="<?php echo Format::htmlchars($_REQUEST['q']); ?>">
&nbsp;&nbsp;
<?php echo __('Query');?>:
<input name="q" type="search" size="30" autofocus
value="<?php echo Format::htmlchars($_REQUEST['q']); ?>">
<input type="submit" name="submit" value="<?php echo __('Search');?>"/>
</div>
</form>
......
......@@ -72,7 +72,8 @@ $info = Format::htmlchars(($errors && $_POST) ? $_POST : $info);
</td>
<td>
<input data-translate-tag="<?php echo $dept ? $dept->getTranslateTag() : '';
?>" type="text" size="30" name="name" value="<?php echo $info['name']; ?>">
?>" type="text" size="30" name="name" value="<?php echo $info['name']; ?>"
autofocus>
&nbsp;<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>
</td>
</tr>
......
......@@ -73,7 +73,7 @@ if ($form && count($langs) > 1) { ?>
lang="<?php echo $cfg->getPrimaryLanguage(); ?>">
<div class="required"><?php echo __('Title'); ?>:</div>
<div>
<input type="text" name="title" size="60"
<input type="text" name="title" size="60" autofocus
value="<?php echo $info['title']; ?>"/>
<i class="help-tip icon-question-sign" href="#form_title"></i>
<div class="error"><?php
......
......@@ -57,7 +57,7 @@ $info=Format::htmlchars(($errors && $_POST) ? array_merge($info,$_POST) : $info)
echo $list->getName();
else {
echo sprintf('<input size="50" type="text" name="name"
data-translate-tag="%s"
data-translate-tag="%s" autofocus
value="%s"/> <span
class="error">*<br/>%s</span>',
$trans['name'], $info['name'], $errors['name']);
......
......@@ -55,7 +55,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<?php echo __('Email Address');?>
</td>
<td>
<input type="text" size="35" name="email" value="<?php echo $info['email']; ?>">
<input type="text" size="35" name="email" value="<?php echo $info['email']; ?>"
autofocus>
&nbsp;<span class="error">*&nbsp;<?php echo $errors['email']; ?></span>
</td>
</tr>
......
......@@ -6,7 +6,8 @@ if(!defined('OSTSTAFFINC') || !$thisstaff) die('Access Denied');
<form id="kbSearch" action="kb.php" method="get">
<input type="hidden" name="a" value="search">
<div>
<input id="query" type="text" size="20" name="q" value="<?php echo Format::htmlchars($_REQUEST['q']); ?>">
<input id="query" type="search" size="20" name="q" autofocus
value="<?php echo Format::htmlchars($_REQUEST['q']); ?>">
<select name="cid" id="cid">
<option value="">&mdash; <?php echo __('All Categories');?> &mdash;</option>
<?php
......
......@@ -42,7 +42,8 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
<?php echo __('Filter Name');?>:
</td>
<td>
<input type="text" size="30" name="name" value="<?php echo $info['name']; ?>">
<input type="text" size="30" name="name" value="<?php echo $info['name']; ?>"
autofocus>
&nbsp;<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>
</td>
</tr>
......
......@@ -54,7 +54,7 @@ $roles = Role::getActiveRoles();
<td width="180" class="required"><?php echo __('Name'); ?>:</td>
<td>
<input size="50" type="text" name="name" value="<?php echo $info['name']; ?>"
data-translate-tag="<?php echo $trans['name']; ?>"/>
autofocus data-translate-tag="<?php echo $trans['name']; ?>"/>
<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>
</td>
</tr>
......
......@@ -54,7 +54,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
</td>
<td>
<input type="text" size="30" name="topic" value="<?php echo $info['topic']; ?>"
data-translate-tag="<?php echo $trans['name']; ?>"/>
autofocus data-translate-tag="<?php echo $trans['name']; ?>"/>
&nbsp;<span class="error">*&nbsp;<?php echo $errors['topic']; ?></span> <i class="help-tip icon-question-sign" href="#topic"></i>
</td>
</tr>
......
......@@ -13,7 +13,9 @@ $info = ($_POST && $errors)?Format::htmlchars($_POST):array();
<?php csrf_token(); ?>
<input type="hidden" name="do" value="scplogin">
<fieldset>
<input type="text" name="userid" id="name" value="<?php echo $info['userid']; ?>" placeholder="<?php echo __('Email or Username'); ?>" autocorrect="off" autocapitalize="off">
<input type="text" name="userid" id="name" value="<?php
echo $info['userid']; ?>" placeholder="<?php echo __('Email or Username'); ?>"
autofocus autocorrect="off" autocapitalize="off">
<input type="password" name="passwd" id="pass" placeholder="<?php echo __('Password'); ?>" autocorrect="off" autocapitalize="off">
<?php if ($show_reset && $cfg->allowPasswordReset()) { ?>
<h3 style="display:inline"><a href="pwreset.php"><?php echo __('Forgot my password'); ?></a></h3>
......
......@@ -78,8 +78,9 @@ $_SESSION['orgs_qs_'.$qhash] = $query;
<input type="hidden" name="a" value="search">
<table>
<tr>
<td><input type="text" id="basic-org-search" name="query" size=30 value="<?php echo Format::htmlchars($_REQUEST['query']); ?>"
autocomplete="off" autocorrect="off" autocapitalize="off"></td>
<td><input type="search" id="basic-org-search" name="query"
autofocus size="30" value="<?php echo Format::htmlchars($_REQUEST['query']); ?>"
autocomplete="off" autocorrect="off" autocapitalize="off"></td>
<td><input type="submit" name="basic_search" class="button" value="<?php echo __('Search'); ?>"></td>
<!-- <td>&nbsp;&nbsp;<a href="" id="advanced-user-search">[advanced]</a></td> -->
</tr>
......
......@@ -62,7 +62,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
</td>
<td>
<input type="text" size="40" name="name" value="<?php echo $info['name']; ?>"
data-translate-tag="<?php echo $trans['name']; ?>"/>
autofocus data-translate-tag="<?php echo $trans['name']; ?>"/>
&nbsp;<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>
</td>
</tr>
......
......@@ -49,7 +49,8 @@ $info = Format::htmlchars(($errors && $_POST) ? array_merge($info, $_POST) : $in
<td width="180" class="required"><?php echo __('Name'); ?>:</td>
<td>
<input size="50" type="text" name="name" value="<?php echo
$info['name']; ?>" data-translate-tag="<?php echo $trans['name']; ?>"/>
$info['name']; ?>" data-translate-tag="<?php echo $trans['name']; ?>"
autofocus/>
<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>
</td>
</tr>
......
......@@ -42,7 +42,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
</td>
<td>
<input type="text" size="30" name="name" value="<?php echo $info['name']; ?>"
data-translate-tag="<?php echo $trans['name']; ?>"/>
autofocus data-translate-tag="<?php echo $trans['name']; ?>"/>
&nbsp;<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>&nbsp;<i class="help-tip icon-question-sign" href="#name"></i>
</td>
</tr>
......
......@@ -50,7 +50,7 @@ $info=Format::htmlchars(($errors && $_POST)?$_POST:$info);
</td>
<td>
<input type="text" size="30" class="staff-username typeahead"
name="username" value="<?php echo $info['username']; ?>">
autofocus name="username" value="<?php echo $info['username']; ?>">
&nbsp;<span class="error">*&nbsp;<?php echo $errors['username']; ?></span>&nbsp;<i class="help-tip icon-question-sign" href="#username"></i>
</td>
</tr>
......
......@@ -58,7 +58,7 @@ $info = Format::htmlchars(($errors && $_POST) ? $_POST : $info);
</td>
<td>
<input type="text" size="30" name="name" value="<?php echo $info['name']; ?>"
data-translate-tag="<?php echo $trans['name']; ?>"/>
autofocus data-translate-tag="<?php echo $trans['name']; ?>"/>
&nbsp;<span class="error">*&nbsp;<?php echo $errors['name']; ?></span>
</td>
</tr>
......
......@@ -17,7 +17,8 @@ if ($info['search'] === false)
if ($info['search'] !== false) { ?>
<div style="margin-bottom:10px;">
<input type="text" class="search-input" style="width:100%;"
placeholder="Search by name" id="org-search" autocorrect="off" autocomplete="off"/>
placeholder="Search by name" id="org-search"
autofocus autocorrect="off" autocomplete="off"/>
</div>
<?php
}
......
......@@ -10,9 +10,9 @@ if (!isset($info['lookup']) || $info['lookup'] !== false) { ?>
: __('Search existing users.');
?></p></div>
<div style="margin-bottom:10px;">
<input type="text" class="search-input" style="width:100%;"
<input type="search" class="search-input" style="width:100%;"
placeholder="<?php echo __('Search by email, phone or name'); ?>" id="user-search"
autocorrect="off" autocomplete="off"/>
autofocus autocorrect="off" autocomplete="off"/>
</div>
<?php
}
......
......@@ -311,9 +311,8 @@ return false;">
<input type="hidden" name="a" value="search">
<table>
<tr>
<td><input type="text" id="basic-ticket-search" name="query"
size=30 value="<?php echo Format::htmlchars($_REQUEST['query'],
true); ?>"
<td><input type="search" id="basic-ticket-search" name="query"
autofocus size="30" value="<?php echo Format::htmlchars($_REQUEST['query'], true); ?>"
autocomplete="off" autocorrect="off" autocapitalize="off"></td>
<td><input type="submit" class="button" value="<?php echo __('Search'); ?>"></td>
<td>&nbsp;&nbsp;<a href="#" onclick="javascript:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment