Board index JavaServer Faces General Add attribute required to Tree

Add attribute required to Tree

Components, Ajax Framework, Utilities and More.

Post 01 Jun 2012, 13:31

Posts: 28
I have a tree with selectionMode checkbox and i want to define that at least one selection is need.
The attribute required is not available in Primefaces 3.2.
I know i can make the check in the bean, but i want to do the check before calling the bean.

    <p:tree value="#{treeBean.root}" var="node" id="checkboxTree" 
            selectionMode="checkbox" 
            selection="#{treeBean.selectedNodes}"
            required="true">
 
        <p:treeNode> 
            <h:outputText value="#{node}" /> 
        </p:treeNode> 
    </p:tree> 


Thanks
---------------------------------------------------------------------------------------------------------------
  • Mojarra 2.1.19 (20130213-1512) / JSF 2.1
  • PrimeFaces 3.5.0 and 4.0-SNAPSHOT
  • Apache Tomcat/6.0.35
  • Oracle JDK 1.6.0_43

kukeltje Expert Member

Posts: 6359
Location: Netherlands
write some javascript that loops through all the checkboxes...
Ronald van Kuijk
______________________________
PrimeFaces 4.0, PrimeFaces plus 0.0.2 | Jboss 7.2.0 | Mojarra 2.1.18
Fedora 19, Firefox 26.0
Read the forum posting rules
Beginners: http://www.coreservlets.com/JSF-Tutorial/jsf2/


Posts: 15049
Location: Cybertron

Not sure about this.
PrimeFaces Lead


Posts: 28
@kukeltje: i always try to avoid writing javascripts

@optimus.prime:
what do you mean, being not sure about this? Difficult to implement?

Cheers
Martin
---------------------------------------------------------------------------------------------------------------
  • Mojarra 2.1.19 (20130213-1512) / JSF 2.1
  • PrimeFaces 3.5.0 and 4.0-SNAPSHOT
  • Apache Tomcat/6.0.35
  • Oracle JDK 1.6.0_43


Posts: 2
Would it be in any way possible to make the tree an EditableValueHolder. Conceptually it is as it is both editable and holds a value. Without this, validation, including required, is very difficult and does not flow well with the JSF lifecycle. I created a stackoverflow question (http://stackoverflow.com/q/14385376/516433) to get suggestions about how to validate this, but if it can be made an EditableValueHolder to start with, then the question is pointless.


Posts: 11
We're having problem with the tree component losing it's selected value if validation fails for another component. I guess this is basically the same problem? A required attribute should solve this since we don't need to do custom validation in backing bean.

lucastheisen wrote:
Would it be in any way possible to make the tree an EditableValueHolder. Conceptually it is as it is both editable and holds a value. Without this, validation, including required, is very difficult and does not flow well with the JSF lifecycle. I created a stackoverflow question (http://stackoverflow.com/q/14385376/516433) to get suggestions about how to validate this, but if it can be made an EditableValueHolder to start with, then the question is pointless.


Posts: 15049
Location: Cybertron

You may consider PrimeFaces PRO so that we can implement your feature requests like these;

http://www.primefaces.org/support.html
PrimeFaces Lead


Posts: 41
With PrimeFaces PRO, it's easy to support, tune and add features to PrimeFaces as if it were an in-house framework.

PrimeFaces PRO is a term based commercial support service. With the exclusive services of Pro account, you no longer need to post your questions in PrimeFaces community forum and your issues to community issue tracker.

Standard PRO Services

Access to pro.primefaces.org
Response at most in 1 business day.
Defect patches.
Private branch management in case you need.
Customized builds.
Unlimited number of cases.
Remote desktop connection.
Conference calls for discussions.
High priority to your issues.
Non PrimeFaces related general JSF assistance.

New Features

New feature and enhancement requests are not available in core services and provided via an hour based model instead. When you have a feature request we provide an estimate, if you confirm we deliver your request within an estimated timeframe and deduct the amount of work from your hours. These requests can be;

- New components.
- New functionality to existing components.
- Changing the way a certain functionality is implemented.
- Proof of Concept implementations of a use case.
- Code reviews to offer best practices.

Hourly rate is 200 usd and discounts apply on bulk purchases that are more than 50. You can purchase additional hours along with the subscription and also anytime during your subscription period. If your subscription term ends with unused hours, they will be added to your new subscription term in case you extend.

To get a quote, please contact us and mention the total number of developers who will be working in your PrimeFaces projects.


Return to General