Auto Submit Demo
<h:form id="example">
<h:panelGrid columns="3">
<p:outputLabel for="otp" value="OTP:"/>
<p:inputText id="otp" size="6" value="#{inputOutputController.value}">
<ejsf:otpValidator/>
<ejsf:autoSubmit target="submit" whenLength="6"/>
</p:inputText>
<p:message for="otp"/>
</h:panelGrid>
<h:panelGrid columns="1">
Submitted OTP is: #{inputOutputController.value}
</h:panelGrid>
<h:panelGrid columns="1">
<p:commandButton id="submit" update="@form" value="Submit"/>
</h:panelGrid>
</h:form>
/*
* Enterprise JSF project.
*
* Copyright 2023 e-Contract.be BV. All rights reserved.
* e-Contract.be BV proprietary/confidential. Use is subject to license terms.
*/
package be.e_contract.demo;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
@Named("inputOutputController")
@RequestScoped
public class InputOutputController {
private String value;
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
}
autoSubmit
Automatically submit upon a condition.
Namespace: | urn:be:e-contract:ejsf |
Required Attributes
Name | Type | Description |
---|---|---|
whenLength | java.lang.Integer | Automatically submit when length of input has been reached. |
Optional Attributes
Name | Type | Description |
---|---|---|
target | java.lang.String | Identifier of the default command component. If not provided, we submit the form. |