No announcement yet.

Form pressing Enter not the same as clicking Save

  • Filter
  • Time
  • Show
Clear All
new posts

  • Form pressing Enter not the same as clicking Save

    I have a form that when I click Save does what I want.... but when I type in the field and press the "enter" key the screen flashes like its doing something, but it doesn't process my code like clicking "Save".
    I have searched the forums but not found exactly what I should do.... I found a few people who use javascript code to manipulate what the "enter" key does.... but I'm not sure how to get a Form to execute javascript onload.
    The reason I need it, is for USB IR scanners that will scan a barcode and press "enter" at the end of the code in order to enter data.
    My database updates occur in an onValidateSuccess event if that makes any difference.

  • #2
    you can always use jscript code by doing something like this in the onloadevent of the form

    PHP Code:
    echo "
        $(function() {
            //Some code here


    • #3
      as kafe says - also for a bit more detail see this post:

      Uses "Enter" as the example.


      • #4
        Here you have to add an event listener to a edit. Use firebug to know the class of your edit.

        Try to echo something like this:

        $(function () {
        		document.getElementById("busc0ador").addEventListener("keypress", function(e){
        			if (e.keyCode === 13) {
        				nm_alterar(); // <-- Search on forum (or use Firebug and insepct Save button) the JS function to save. I don't remember exactly

        Professional Scriptcase Services
        Some Customers opinions