• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adding Objects to an ArrayList (Checkboxes)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding Objects to an ArrayList (Checkboxes)


  • Subject: Re: Adding Objects to an ArrayList (Checkboxes)
  • From: David LeBer <email@hidden>
  • Date: Mon, 10 Oct 2005 20:52:06 -0400


On 10-Oct-05, at 7:51 PM, Janice Cheung wrote:

   Hi David,



When I do setAllServersTrue, my servers are being passed correctly over:


   public WOComponent setServersTrue(){
   UserHome nextPage=(UserHome)pageWithName(UserHome);
   nextPage.fetchByDnsName();
   nextPage.setSelectedObjects(m_ServersA);
   return nextPage;
   }



When you do this, do all of the checkboxes appear "checked"?



   Yes, when I do that, all the checkboxes appear "checked".

   I noticed that when I do this:

public void setObjectSelected(boolean value) {
System.out.println("Now in setObjectsSelected with value: " + value + " and server: " + server);
if (value) {


nothing ever prints out when I go to the nextPage from my EmailServerContacts() method. It seems as though
setObjectSelected doesn't get accessed to update the checked checkBoxes. Is there a way to ensure that
setObjectSelected is called?


   Thanks so much for helping me..

Janice

Well, to be honest I don't know what's going on at this point. But lets look at a couple potential reasons for this misbehavior.


The WOCheckbox is a form element. That means it needs to be in a form and it's values 'submitted'. So check to make sure you have a WOForm wrapping the entire repetition. Also make sure that form contains a WOSubmitButton and that button is what is calling your emailServerContacts()

Alternately, make sure you don't have a public instance variable named objectSelected in the component. There could be the chance WO is hitting it directly instead of using the objectSelected() and setObjectSelected(boolean value) methods.


If so that is good, it means that the bindings are correct.

Also, I notice there is a bug in the code that I wrote (damn typing off the top of my head!). This is wrong:

public boolean setObjectSelected(boolean value) {
<snip>

It should be:

public void setObjectSelected(boolean value) {
            ^^^^

Setter methods shouldn't have a return type (oops).

Since things are still not working, I recommend you follow Ken's advice and add some kind of log statement to that method to track down where it is breaking. ie:

public void setObjectSelected(boolean value) {
System.out.println("Now in setObjectsSelected with value: " + value + " and server: " + server);
if (value) {
---etc---


--
;david

--
David LeBer
"I am codeferous!"
Codeferous Software
site:   http://www.codeferous.com
blog: http://david.codeferous.com




_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Wanting to return an .XML document for a direct action (From: WebObjects <email@hidden>)
 >Adding Objects to an ArrayList (Checkboxes) (From: Janice Cheung <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: Ken Anderson <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: Janice Cheung <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: David LeBer <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: Janice Cheung <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: Ken Anderson <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: Ken Anderson <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: Ken Anderson <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: Janice Cheung <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: David LeBer <email@hidden>)
 >Re: Adding Objects to an ArrayList (Checkboxes) (From: Janice Cheung <email@hidden>)

  • Prev by Date: Re: Adding Objects to an ArrayList (Checkboxes)
  • Next by Date: Re: Webobjects link missing from http://developer.apple.com
  • Previous by thread: Re: Adding Objects to an ArrayList (Checkboxes)
  • Next by thread: Re: Adding Objects to an ArrayList (Checkboxes)
  • Index(es):
    • Date
    • Thread