0

i want to use validation on multiple component.In the form there are three h:selectOneMenu components and some h:inputText components. on change of first h:selectOneMenu i need to change content of second without validating other fields.Here i have use immediate="true". Similarly for second h:selectOneMenu components onchanging need to change content of third SelectList here to i want to skip validation for others and i used immediate=true for this component too. Problem is" immediate= true and FacesContext.getCurrentInstance().renderResponse()" work for nonImediate components only.but as there are two component with immediate=true , on changing first Select one error is shown on second SelectOne list.Do anyone have any idea about this ? Thanks in advanced. I am using JSF 1.2

black_panther
  • 13
  • 2
  • 8

1 Answers1

0

On selecting first h:selectOneMenu you can use value change listener in which you can do your stuff in the bean and can change the content of the second h:selectOneMenu.You need to re render this component. This way your immediate="true" part will be eliminated from the

So now you can put just one immediate="true" in the page and you can do your valdiation only on one field.

If re rendering and value change listener is not what you want to use, then you can put the first immediate="true" component inside the first form and second immediate="true" inside another form.

This way since both the forms are different your validation in both the cases will run only when that particular form is submitted or processed.

AngelsandDemons
  • 2,823
  • 13
  • 47
  • 70
  • thanks for reply. But problem is for some reason ajax is not working in my application, so i cannot use reRender . For second solution can you provide sample example for how to use multiple form in xhtml in jsf 1.2. – black_panther Apr 23 '12 at 14:17
  • I guess working with rerender attribute will make your life easier.You can debug why ajax is not working in your application as for all these functionalities it is good to have ajax property working perfectly on the page. For multiple forms you can just include two forms in xhtml page.I have not used JSF with facelets so I am not sure if the methodology to include two forms is different that using JSF(2.0) with JSPs.With jsps I just use 2 forms with with different form IDs for both the forms. – AngelsandDemons Apr 25 '12 at 13:21