- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2023 09:48 AM - edited 06-19-2023 07:41 AM
Hello good people 🙂
Sorry for the basic question, but I've searched around with no luck. The title pretty much says it all, is there a way to avoid this functionality?
Even a simple <input> seems to submit the form, should the user type something and finish with enter.
Example:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:ui_form>
<input></input>
<g:dialog_button_ok type="submit"/>
</g:ui_form>
</j:jelly>
The issue, is that users are likely to submit an unfinished form by mistake. Some fields are optional, but they shouldn't submit a half filled form by accident.
Changing the "dialog_button_ok" button to type="button" avoids this, but I've yet to be able to submit the form from client script; thought it would be possible using a "document.getElementById" and then doing a .submit() - but it doesn't seem to work.
Help would be much appreciated 🙂
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 07:41 AM
For anyone interested, its solvable by checking for keydown event. Add this to client script.
$j(document).ready(function () {
$j(window).keydown(function (event) {
if (event.keyCode == 13 && !$j(event.target).is(":button")) {
event.preventDefault();
return false;
}
});
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2023 07:41 AM
For anyone interested, its solvable by checking for keydown event. Add this to client script.
$j(document).ready(function () {
$j(window).keydown(function (event) {
if (event.keyCode == 13 && !$j(event.target).is(":button")) {
event.preventDefault();
return false;
}
});
});