Pre-fill JSF form on button before final form submit -



Pre-fill JSF form on button before final form submit -

i pre-fill form, not pre-fill while loading page when user pushes button. "fill form informations product depending on id (user have write it)". can see illustration on image linked below. commandbutton "fetch data" create job , fills fields on form when submit form, values product name, weight , descriptions null, , because of jsf lifecycle (after first submit application goes steps 5 , 6 in jsf lifecycle), help me it? thanks

screenshot - form example

<?xml version="1.0"?> <f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.org/ui" xmlns:ui="http://java.sun.com/jsf/facelets" > <h:head> </h:head> <h:body style="vertical-align:middle;margin:auto"> <h:form enctype="multipart/form-data"> <p:growl id="growl" life="2000" /> <div id="container"> <div class="divs"> <p class="header_single">example</p> <table class="tablica"> <tr> <td> <p:outputlabel for="p_id" value="product id:*" styleclass="f_text" /> <p:inputtext id="p_id" value="#{formvalidationbean1.mbo}" required="true" requiredmessage="required field"> <f:ajax event="blur" render="err_msg1"/> </p:inputtext> </td> <td class="butt"> <p> <p:commandbutton value="fetch data" actionlistener="#{formvalidationbean1.fillform}" update="p_name p_weight p_desc" icon="ui-icon-refresh" /> </p> </td> <td> <p> <p:message id="err_msg1" for="p_id" /> </p> </td> <td> </td> </tr> <tr> <td> <p:outputlabel for="p_name" value="product name:*" styleclass="f_text" /> <p:inputtext id="p_name" value="#{formvalidationbean1.pname}" readonly="true"></p:inputtext> </td> <td> <p:message for="p_name" display="text" /> </td> <td> </td> <td> </td> </tr> <tr> <td> <p:outputlabel for="p_weight" value="product weight:" styleclass="f_text" /> <p:inputtext id="p_weight" value="#{formvalidationbean1.pweight}" readonly="true"></p:inputtext> </td> <td> <p:message for="p_weight" display="text" /> </td> <td> <p:outputlabel for="p_desc" value="product description:" styleclass="f_text" /> <p:inputtext id="p_desc" value="#{formvalidationbean1.pdesc}" readonly="true"></p:inputtext> </td> <td> <p:message for="p_desc" display="text" /> </td> </tr> </table> </div> <div class="submit"> <p:commandbutton value="submit" id="ajax" update="growl" actionlistener="#{formvalidationbean1.someaction}" styleclass="button" /> </div> </div> </h:form> </h:body> </f:view>

forms jsf jsf-2 primefaces lifecycle

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -