User story #1469
Popups to create items should be validated when hitting the return key
Popups used to create items ask for a name and a description (sometimes other things too). When you've finished typing, one often hits return to save. However, return currently causes "cancel" to happen instead, which is very counter-intuitive. Hitting return should cause the "save" button to be "clicked".Exhaustive list:
- Group screen, "Create a new item" (for groups and categories)
- Search screen, "Create node group from this query"
- Configuration rule management screen, "Add a new rule"
- Policy Management screen, "Create a new policy based on template X"
- Policy Template library management, "Create a new category"
#1 Updated by François ARMAND over 5 years ago
There is not HTML standard way to specify that:
But that workaround seems to work: http://stackoverflow.com/questions/925334/how-is-the-default-submit-button-on-an-html-form-determined/5578124#5578124
So, as it's the simplest, I think we should use it.
#2 Updated by François ARMAND over 5 years ago
Or not, as it does not seems to work with ajax form. So perhaps look at a JQuery solution, like:
#11 Updated by François ARMAND about 5 years ago
- Status changed from Pending technical review to 2
That seems to not have been sufficiently tested: when on pop-up with other inputs than name/description, the behaviour is still to close the pop-up without saving.
For example, on the search page, when you "create a group from that search", select "dynamic" and press enter, nothing is saved.
Apart from that, the provided correction seems ok.
#15 Updated by Nicolas CHARLES about 5 years ago
- Status changed from Pending technical review to Pending functional review
This looks valid from a technical point of view, thank you Arthur
However, some comments in the js file to explain what the function does and when to use it would have been great