[Rt-commit] rt branch, 4.0/form-buttons-ordering, created. rt-4.0.21-20-ga73603c

Wallace Reis wreis at bestpractical.com
Thu Sep 11 15:17:09 EDT 2014


The branch, 4.0/form-buttons-ordering has been created
        at  a73603cd1da31406180fe7d6fe20baadf9e1274e (commit)

- Log -----------------------------------------------------------------
commit ddb2cf9d76b68d18055e4de1b7a71c5867876fd9
Author: Wallace Reis <wreis at bestpractical.com>
Date:   Wed Aug 27 17:58:10 2014 -0300

    Button ordering on update user page
    
    1b39bc1c tried to address this issue, however modern browsers still
    submit the form when hitting enter. The 1b39bc1c changeset provides
    a good UX tho, by hiding the "Reset Auth Token" button.
    
    Thus, a proper solution is to put the save submit button first in
    the source since browser uses the first one as default button when
    hitting enter and it doesn't make a lot of sense UI-wise to have
    the button between the form fields and their submit element anyway.
    
    Fixes I#19431.

diff --git a/share/html/User/Prefs.html b/share/html/User/Prefs.html
index d91a149..c1d2957 100644
--- a/share/html/User/Prefs.html
+++ b/share/html/User/Prefs.html
@@ -167,6 +167,8 @@
 </table>
 </&>
 
+<& /Elements/Submit, Label => loc('Save Preferences') &>
+
 <&| /Widgets/TitleBox, title => loc('Secret authentication token'), id => "user-prefs-feeds" &>
 
 <&|/l&>All iCal feeds embed a secret token which authorizes you.  If the URL one of your iCal feeds got exposed to the outside world, you can get a new secret, <b>breaking all existing iCal feeds</b> below.</&>
@@ -196,7 +198,6 @@
 
 % $m->callback( %ARGS, UserObj => $UserObj, CallbackName => 'FormEnd' );
 
-<& /Elements/Submit, Label => loc('Save Preferences') &>
 </form>
 
 

commit a73603cd1da31406180fe7d6fe20baadf9e1274e
Author: Wallace Reis <wreis at bestpractical.com>
Date:   Thu Sep 11 15:12:07 2014 -0400

    Button ordering on ticket create/modify pages
    
    Form buttons as submit input type are triggered when hitting enter causing
    other actions in those pages to be fired instead of "Create" or
    "Save Changes" ones.
    
    Transforming them into button input type doesn't get the value posted as
    part of form data. Thus, we need to shove a hidden input value and trigger
    the form submit.
    
    Fixes I#19431.

diff --git a/share/html/Articles/Elements/BeforeMessageBox b/share/html/Articles/Elements/BeforeMessageBox
index 4339ca1..e7a619f 100644
--- a/share/html/Articles/Elements/BeforeMessageBox
+++ b/share/html/Articles/Elements/BeforeMessageBox
@@ -58,7 +58,7 @@
 <tr>
 <td><&|/l&>Include Article:</&></td>
 <td><input size=20 name="<% $name_prefix %>Articles-Include-Article-Named" /></td>
-<td><input type="submit" name="Go" value="Go" /></td>
+<td><input type="button" class="button" name="Go" value="Go" onclick='jQuery("input[name=Go]").before("<input type=hidden name=Go value=1 />"); jQuery("form").submit();'/></td>
 </tr>
 % }
 % if ($hotlist->Count) {
diff --git a/share/html/Ticket/Elements/AddAttachments b/share/html/Ticket/Elements/AddAttachments
index 9458bbb..e9c95a2 100644
--- a/share/html/Ticket/Elements/AddAttachments
+++ b/share/html/Ticket/Elements/AddAttachments
@@ -56,6 +56,9 @@
 </tr>
 % } # end of if
 
-<tr><td class="label"><&|/l&>Attach</&>:</td><td><input name="Attach" type="file" /><input type="submit" class="button" name="AddMoreAttach" value="<&|/l&>Add More Files</&>" /><input type="hidden" class="hidden" name="UpdateAttach" value="1" />
+<tr><td class="label"><&|/l&>Attach</&>:</td><td>
+    <input name="Attach" type="file" />
+    <input type="button" class="button" name="AddMoreAttach" value="<&|/l&>Add More Files</&>" onclick='jQuery("input[name=AddMoreAttach]").before("<input type=hidden name=AddMoreAttach value=1 />"); jQuery("form").submit();' />
+    <input type="hidden" class="hidden" name="UpdateAttach" value="1" />
 </td></tr>
 % $m->callback( %ARGS, CallbackName => 'End' );
diff --git a/share/html/Ticket/Elements/EditPeople b/share/html/Ticket/Elements/EditPeople
index 9110aed..2321bb5 100644
--- a/share/html/Ticket/Elements/EditPeople
+++ b/share/html/Ticket/Elements/EditPeople
@@ -52,11 +52,11 @@
 <h3><&|/l&>New watchers</&></h3>
 <&|/l&>Find people whose</&><br />
 <& /Elements/SelectUsers &>
-<input type="submit" class="button" name="OnlySearchForPeople" value="<&|/l&>Go!</&>" />
+<input type="button" class="button" name="OnlySearchForPeople" value="<&|/l&>Go!</&>" onclick='jQuery("input[name=OnlySearchForPeople]").before("<input type=hidden name=OnlySearchForPeople value=1 />"); jQuery("form").submit();'/>
 <br />
 <&|/l&>Find groups whose</&><br />
 <& /Elements/SelectGroups &>
-<input type="submit" class="button" name="OnlySearchForGroup" value="<&|/l&>Go!</&>" />
+<input type="button" class="button" name="OnlySearchForGroup" value="<&|/l&>Go!</&>" onclick='jQuery("input[name=OnlySearchForGroup]").before("<input type=hidden name=OnlySearchForPeople value=1 />"); jQuery("form").submit();'/>
 
 <& AddWatchers, Ticket => $Ticket, UserString => $UserString,
         UserOp => $UserOp, UserField => $UserField,

-----------------------------------------------------------------------


More information about the rt-commit mailing list