Page 1 of 1

Add attribute required to Tree

Posted: 01 Jun 2012, 13:31
by jimmybondy
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.

Code: Select all

    <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

Re: Add attribute required to Tree

Posted: 01 Jun 2012, 13:58
by kukeltje
write some javascript that loops through all the checkboxes...

Re: Add attribute required to Tree

Posted: 01 Jun 2012, 14:25
by cagatay.civici
Not sure about this.

Re: Add attribute required to Tree

Posted: 01 Jun 2012, 16:13
by jimmybondy
@kukeltje: i always try to avoid writing javascripts

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

Cheers
Martin

Re: Add attribute required to Tree

Posted: 17 Jan 2013, 20:21
by lucastheisen
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.

Re: Add attribute required to Tree

Posted: 29 Jan 2013, 09:58
by magnilex
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.

Re: Add attribute required to Tree

Posted: 29 Jan 2013, 10:08
by cagatay.civici
You may consider PrimeFaces PRO so that we can implement your feature requests like these;

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

Re: Add attribute required to Tree

Posted: 29 Jan 2013, 11:10
by PrimeFaces PRO
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.