Rank: Advanced Member
Groups: Authorized User, Developers, Registered, HelpDesk Joined: 1/7/2019(UTC) Posts: 112
Thanks: 1 times Was thanked: 2 time(s) in 2 post(s)
|
When using the Admin/Shipments/Ship Items tool, it is too easy to accidentally complete the shipment by hitting the enter key when editting any field on the page.
Can we disable the "Submit on Enter" functionality on this page and require the user to explicitly click the "Ship" button after they have had a chance to confirm all shipping details?
For example, if you are editting a Quantity to Ship and happen to hit the "Enter" key, the form is immediately submitted (maybe without tracking information).
Another example is when using a bar-code scanner to populate the Tracking Number field....the scanner may transmit an "Enter" after scanning the barcode and this will immediately submit the form without any chance to further review the shipment details.
Thanks for help on this.
-Jeff
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers, Registered, HelpDesk Joined: 1/7/2019(UTC) Posts: 112
Thanks: 1 times Was thanked: 2 time(s) in 2 post(s)
|
I was able to find a solution to this problem that is currently working for me. I'm posting it so others can use it for what it's worth. Apparently the standard states that "A form element's default button is the first submit button in tree order whose form owner is that form element." So the trick is to define a disabled, decoy button first, effectly trapping the Enter key working from activating the actual Submit Button in the form. You must specifically click the "Ship" button to submit this form. Please let me know if this isn't an appropriate solution. -Jeff Open the \Areas\Admin\Views\Orders\ _ShipOrder.cshtml file and search for: Code:
<div class="button-group">
@Ajax.ActionLink("Cancel", "OrderShipments",
new { OrderNumber = Model.OrderNumber },
new AjaxOptions
{
UpdateTargetId = "view-order-tab-container",
OnSuccess = "SetActiveTab('Shipments')",
}, new { @class = "btn btn-white" })
<button type="submit" class="btn btn-primary">Ship</button>
</div>
and replace like this: Code:
<div class="button-group">
@Ajax.ActionLink("Cancel", "OrderShipments",
new { OrderNumber = Model.OrderNumber },
new AjaxOptions
{
UpdateTargetId = "view-order-tab-container",
OnSuccess = "SetActiveTab('Shipments')",
}, new { @class = "btn btn-white" })
<!-- Prevent implicit submission of the form -->
<button type="submit" disabled style="display: none" aria-hidden="true"></button>
<!-- ... -->
<button type="submit" class="btn btn-primary">Ship</button>
</div>
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
I think the solution is appropriate and will resolve the issue. You can also intercept the enter key listener in jquery. Code:$(document).ready(function() {
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
});
Note: I have registered this issue. Edited by user Wednesday, December 23, 2020 4:15:03 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member
Groups: Authorized User, Developers, Registered, HelpDesk Joined: 1/7/2019(UTC) Posts: 112
Thanks: 1 times Was thanked: 2 time(s) in 2 post(s)
|
Thank you for the additional option. It may become handy for other pages.
Can you advise where in the file the code snippet should be placed?
Thanks!
-Jeff
|
|
|
|
Rank: Advanced Member
Groups: Admin, Developers, Registered, HelpDesk, Authorized User Joined: 10/5/2018(UTC) Posts: 704
Thanks: 5 times Was thanked: 113 time(s) in 112 post(s)
|
Hi Jeff,
You can add this code snippet in \Website\Areas\Admin\Scripts\custom\app.js This is the admin side global custom js file.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close