logo
down
shadow

Enter Key Press behave like Submit in JSF


Enter Key Press behave like Submit in JSF

By : Shwetha
Date : October 28 2020, 04:55 PM
Hope that helps I haven't seen this issue before. The chance is little that this behaviour is browser specific. Try in different kinds of browsers to exclude the one and other (IE6/7/8, FF, Safari, Chrome, etc). The chance is bigger that this is caused by a (poor) Javascript key event listener which incorrectly suppresses the enter key (for example a JS password validator which checks the entered characters).
If still in vain, just add the following onkeypress to the h:form:
code :


Share : facebook icon twitter icon
If I have an html form with one text input, does it submit when I press enter even if I don't have a submit button?

If I have an html form with one text input, does it submit when I press enter even if I don't have a submit button?


By : Uncel Dolan
Date : March 29 2020, 07:55 AM
This might help you In a
, one can submit by pressing the Enter key when you have a text input but hide your submit button.
code :
<form action="wherever">
    <input type="text" name="input" />
    <input type="submit" value="Submit" name="submit" style="display: none;" />
</form>
Submit textarea form without a submit button with Enter key press

Submit textarea form without a submit button with Enter key press


By : dorris
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further This code flow works fine in a jsfiddle test. Note that you should not be using e.charCode, as e.keyCode (IE) and e.which (everything else) suffice. See this question.
Also, your code for finding the form is overly complex and not necessary, change this:
code :
var form = target.form;
...
document.forms[this.form.id].submit();
target.form.submit();
in textbox how when when I press ENTER submit the Form and when I press shift+ENTER insert new line

in textbox how when when I press ENTER submit the Form and when I press shift+ENTER insert new line


By : Ben
Date : March 29 2020, 07:55 AM
will help you might have a solution for your submit on Enter
Assuming you're using jquery :
code :
 $('your-input-selector').keypress(function(event) {
     if (event.keyCode == 13) {
       $('form').submit();
     }
 });
<input type="text" onkeypress="myKeyPressHandler(event)">
function myKeyPressHandler(event) {
  if (event.keyCode == 13) {
    document.getElementById("myForm").submit();
  }
}
  $('your-selector').keyup(function (e) {
            if (e.which === 13 && e.shiftKey) {
                alert('shift enter pressed');
                //Do your work here
            }
        });
<input type="text" onkeyup="myKeyUpHandler(event)">
function myKeyUpHandler(e) {
    if (e.which === 13 && e.shiftKey) {
        alert('shift enter pressed');
                //Do your work here
    }
}
How can I press enter go down line on textarea when form submit is disable keypress enter

How can I press enter go down line on textarea when form submit is disable keypress enter


By : harold
Date : March 29 2020, 07:55 AM
will help you Submit is disabled for keypress enter on textarea also I want to go the new line when enter is pressed on textarea. How can I modify below code? , Try out this ;)
code :
$('textarea').bind('keypress', function(e) {
    if ((e.keyCode || e.which) == 13) {
        e.preventDefault();

        //Just add this line to your code
        $(this).val($(this).val()+'\n');

        return false;
    }
});
Submit form when press enter, not press button

Submit form when press enter, not press button


By : prike
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I have this code , You could do like this :
code :
$('#txtCodigoCIE10').keydown(function(e){
    var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
    if(key == 13) 
    {
        e.preventDefault();
        $('form').submit();
    }
});
Related Posts Related Posts :
  • Java - JPA - Generators - @SequenceGenerator
  • What's a good Java-based Master-Slave communication mechanism?
  • Design Help/Suggestion required
  • NullPointerException in com.sun.tools.jxc.SchemaGenTask
  • time required to finish the multithreaded program?
  • Traditional IO vs memory-mapped
  • Using StringBuilder to process csv files to save heap space
  • Response Time is different for mulitiple execution of the application with the same request Performance problem
  • Java - Weblogic - JMX : request available free memory on all servers
  • Error: Can't find common super class of
  • JNI problem when calling a native library that loads another native library
  • calling Stanford POS Tagger maxentTagger from java program
  • Notification framework for java
  • hide keyboard in android?
  • Alternative of JPA
  • How to get Java XP Look and Feel
  • Remote JMS connection still using localhost
  • Java NoClassDefFoundError
  • Is O(N!*N) an acceptable big oh complexity class or do I remove the constant and just say O(N!)?
  • Java File URI error?
  • Using an interface as a constructor parameter in Java?
  • Add additional path to exec-maven-plugin
  • Natural Language parsing of an appointment?
  • Java: How to tell which fontconfig file my system is currently using?
  • How to create notification icon badge on Android apps (like iPhone)
  • Interfaces with hibernate annotations
  • Getting ConnectionTimeoutException with the host did not accept the connection within timeout
  • How to get all property names of a Groovy class?
  • Java Netscape LDAP Remove One Attribute
  • A simple two column layout with Swing
  • Making a Linked list using Generics
  • how to handle result set data
  • Cloning java ArrayList and preventing it from modifications
  • Java How to call method of grand parents?
  • running jython bytecode using java
  • get content from website with utf8 format
  • Sendgrid v3: "Substitutions may not be used with dynamic templating"
  • Application freezes when running method
  • Maven versioning using git branches
  • does a Java getter incur a performance penalty
  • Open Source Implementation of Checkers
  • How can I make a resizable array in Java?
  • Change size of ImageIcon in a JRadioButton
  • Java memory mapped files and swap
  • JAXB Annotated class - setting of a variable which is not an element
  • JSF don't find component in view root with the form id
  • Using Mockito, how do I match against the key-value pair of a map?
  • How do I run my application as superuser from Eclipse?
  • Spring-Security: Call method after authentication
  • How can I add a password to this JDBC:ODBC connection string that is trying to connect to an MS Access database
  • java.sql.SQLException: database locked
  • Json Jackson deserialization without inner classes
  • Error starting modern compiler
  • Generate a random number in interval [0,360) which is divisible by number 15
  • Rotate watermark text at 45 degree angle across the center Apache PDFBox
  • Generate Random number in a range with no repeatation
  • Starting HBASE, java.lang.ClassNotFoundException: org.apache.htrace.SamplerBuilder
  • Using getter and setter methods inside a class in my main class
  • java: <identifier> expected with ArrayList
  • Java Reflection, java.lang.IllegalAccessException Error
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk