Add attribute required to Tree

UI Components for JSF
Post Reply
jimmybondy
Posts: 28
Joined: 30 Jan 2012, 17:21

01 Jun 2012, 13:31

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
---------------------------------------------------------------------------------------------------------------
  • 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
[/color]

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

01 Jun 2012, 13:58

write some javascript that loops through all the checkboxes...

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

01 Jun 2012, 14:25

Not sure about this.

jimmybondy
Posts: 28
Joined: 30 Jan 2012, 17:21

01 Jun 2012, 16:13

@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
[/color]

lucastheisen
Posts: 2
Joined: 04 Jan 2013, 22:51

17 Jan 2013, 20:21

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.

magnilex
Posts: 11
Joined: 25 Jun 2012, 09:44

29 Jan 2013, 09:58

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.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

29 Jan 2013, 10:08

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

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

PrimeFaces PRO
Posts: 41
Joined: 27 Jan 2013, 23:44

29 Jan 2013, 11:10

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.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 35 guests