Is it ok to call to update ids of fields that are diff' form

UI Components for JSF
Post Reply
User avatar
daniel_r
Posts: 199
Joined: 02 Mar 2009, 16:35

09 Jan 2011, 21:58

Hi i had the following situation

I had form in which i got input field with validation and submit button which placed the values of the input field into a table

The table had delete column which allowed to delete a row

the thing is that the delete row link failed on validation if there was no value in the input field


so i placed the input field with the submit button in 1 form and in the second form i placed the data table

now when user type the value into the input field and clicks on the submit i update id of the table (which is located inside the second form, i use the update attribute of the command button)

my question is this right thing to do? or i better place all inside one form

here is the input field code (using 2.2.RC2)

Code: Select all

<h:inputText id="email" value="#{settingsBean.aFriendEmail}" required="true" label="Email" validatorMessage="The email is not correct">
											<f:validateRegex pattern="[a-zA-Z0-9]+@[a-zA-Z0-9]+\.[a-zA-Z0-9]+" />
										</h:inputText>
here is the delete column code

Code: Select all

  <p:column headerText="Delete" style="width:30px">
							           <p:commandLink ajax="true" action="#{settingsBean.removeEntity}" update="@form" process="@form" styleClass="ui-icon ui-icon-trash">
									        <f:setPropertyActionListener
										         target="#{settingsBean.selectedFriendToDeleteFromTable}"
										         value="#{friend}" />
									    </p:commandLink>
							        </p:column> 

Thanks ahead

Daniel.
Primefaces 3.4 , MyFaces 2.0.11
Tomcat 6
Win7 32bit

nitin_o
Posts: 17
Joined: 06 Nov 2009, 08:43

10 Jan 2011, 12:14

Try qualifying your update with the formId

i.e. update="<formid>:<elementid>"

User avatar
daniel_r
Posts: 199
Joined: 02 Mar 2009, 16:35

11 Jan 2011, 12:41

the update works fine with tow forms

I was just wondering if its possible to implement in one form, and just "skip" the validation when the delete is clicked...
Primefaces 3.4 , MyFaces 2.0.11
Tomcat 6
Win7 32bit

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

11 Jan 2011, 15:59

You'll need to limit which fields are processed. Don't include the input which was failing validation. In the code above you have process="@form". Try the value @this.

User avatar
daniel_r
Posts: 199
Joined: 02 Mar 2009, 16:35

11 Jan 2011, 23:03

Thanks allot!!!!! :)


works 100%


say , i tried to find some docs about the process and update of primefaces... but haven't found, any chance you can give me some direction?
Primefaces 3.4 , MyFaces 2.0.11
Tomcat 6
Win7 32bit

User avatar
bumble.bee
Posts: 723
Joined: 29 Sep 2010, 21:39
Location: United States

12 Jan 2011, 15:48

The update and process attributes are enhanced versions of the standard JSF render and execute attributes respectively.

You could probably find some JSF resources on the web about the standard attributes or check out a book such as Core Java Server Faces 3rd Edition (http://horstmann.com/corejsf/).

Once you understand the standard attributes you can learn about the enhanced versions by checking out this thread: http://primefaces.prime.com.tr/forum/vi ... f=3&t=6028. The userguide may also provide a little insight, but it is currently out-of-date (http://www.primefaces.org/documentation.html).

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests