I should think before firing off emails next time. I was thinking of the 
"checked" binding, not "value". I haven't used the "selection" and "value" 
bindings since being seduced by the power of "checked" long ago. Sorry for 
increasing the confusion level!

Regards,
Mark

On Jun 17, 2011, at 7:14 AM, Alexis Tual wrote:

> Your WORepetition should have
>  
> list = listIng
> item = currentIngenieur
> 
> your WOCheckbox :
> 
> checked = ingChecked
> 
> your Java :
> 
> public boolean ingChecked()
> 
> public void setIngChecked(...)
> 
> 
> Le 17 juin 2011 à 13:46, <naneon.raym...@neuf.fr> <naneon.raym...@neuf.fr> a 
> écrit :
> 
>> Hi Alex,
>> 
>> Thanks for your help, but when I use your example I have 
>> javaNullPointerException because the checkBox "checked" is bound to this 
>> method : 
>> 
>>      public boolean isIngChecked() {
>>              return listIng.containsObject(currentIngenieur.diplSpecAbr()); 
>> ===>JavaNullPointerException
>>      }
>> 
>> and java don't like the returned value. When I return a boolean variable, it 
>> works but there another problem on setter method. WO don't the setter method 
>> so I have this exception : 
>> 
>> <sig.utt.fr.Session 0xe956bd> takeValueForKey(): attempt to assign value to 
>> unknown key: 'isIngChecked'.
>> This class does not have an instance variable of the name isIngChecked or 
>> _isIngChecked, nor a method of the name setIsIngChecked or _setIsIngChecked
>> 
>>      public void setIngChecked(boolean isIngChecked) {
>>              this.isIngChecked = isIngChecked;
>>              boolean isAlreadySelected = isIngChecked();
>>              if (!isAlreadySelected && isIngChecked)
>>                      listIng.addObject(currentIngenieur.diplSpecAbr());
>>              else if (isAlreadySelected && !isIngChecked)
>>                      listIng.removeObject(currentIngenieur.diplSpecAbr());
>>      }
>> 
>> My CheckBox : 
>> 
>> ingenieurCheck : WOCheckBox {
>>      class = "texte";
>>      name = "ingenieur";
>>      checked = isIngChecked;
>>      //value = currentIngenieur.diplSpecAbr;
>>      //onclick = "IngChecked(this.form)";
>> }
>> 
>> Ray
>> 
>> 
>> ========================================
>> 
>> Message du : 17/06/2011
>> De : "Alexis Tual " <alexis.t...@gmail.com>
>> A : "Alexis Tual" <alexis.t...@gmail.com>
>> Copie à : naneon.raym...@neuf.fr, ma...@onpointsoftware.com, 
>> ch...@global-village.net, webobjects-dev@lists.apple.com
>> Sujet : Re: How to get each CheckBox value inside a WORepetition Bind to the 
>> same variable
>> 
>> 
>> Erf sorry my bad, see below :
>> 
>> Le 17 juin 2011 à 10:32, Alexis Tual a écrit :
>> 
>>> Hi,
>>> 
>>> you need an array to store the selected objects, here's un example to a 
>>> selection of movies.
>>> Bind the checkbox's selection to "movieSelected" :
>> You need to use the "checked" binding of WOCheckBox, not "selection"...
>> 
>> 
>>> 
>>> public boolean movieSelected() {
>>>     return selectedMovies.containsObject(currentMovie);
>>> }
>>> 
>>> public boolean setMovieSelected(boolean checked) { 
>>>     boolean isAlreadySelected = movieSelected();
>>>     if (!isAlreadySelected && checked)
>>>             selectedMovies.addobject(currentMovie);
>>>     else if (isAlreadySelected && !checked)
>>>             selectedMovies.removeObject(currentMovie);
>>> }
>>> 
>>> Cheers
>>> 
>>> Alex
>>> 
>>> Le 17 juin 2011 à 10:05, naneon.raym...@neuf.fr a écrit :
>>> 
>>>>> Hi,
>>>>> [snip]
>>>> 
>>>>> masterCheck : WOCheckBox { 
>>>>> class = "texte"; 
>>>>>  name = "master";
>>>>> *To Chuck ===> Why I can't give the same name of my checkboxes?*
>>>>> 
>>>>>  selection = selectedMaster; ----->Variable bind to check box value
>>>>>  value = master.diplSpecAbr; --->CheckBox value
>>>>> // onclick = "MstChecked(this.form)";----> JS function wo call a java 
>>>>> method to get checkbox value
>>>> 
>>>> The only binding you need to get the checkbox value is the "value" 
>>>> binding. This is two-way, just like a WOString. When the page is 
>>>> displayed, it will try to evaluate diplSpecAbr or getDiplSpecAbr. When the 
>>>> form is submitted, it will call setDiplSpecAbr. (Or it will try to read 
>>>> and set the variable, if that's what it is vs. accessor methods.) 
>>>> 
>>>> You don't need the "selection" or "onclick" to get the values back. 
>>>> master.diplSpecAbr, for each item, will just be set to the value 
>>>> automatically when the form is submitted.
>>>> ===>When I don't put 'selection' in attribute of my checkBox in WOD I have 
>>>> this error  : if either selection or value is bound, then both must be 
>>>> bound. So it's important to have 'selection' attribute for a checkBox in 
>>>> WO.
>>>> 
>>>> ===> If I don't have 'selection' which is bound to the value of my 
>>>> checkBox, How I get my selectedValue in the nextPage of my apps?
>>>> 
>>>> For checkboxes, it's often useful to have accessor methods in the page's 
>>>> java that explicitly translates between the checkbox's boolean and the 
>>>> meaning in the object. You would have access to the "master" item from the 
>>>> repetition there, so implementation is straightforward.
>>>> 
>>>> ===>I have my accessor methods in the page's java. When I select the 
>>>> checkBox, it set the value the selection variable. and when I want to get 
>>>> this value, I call get of the selection variable. But in this case, we are 
>>>> in another context. Do you have an example for me?
>>>> 
>>>> Thanks
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> http://lists.apple.com/mailman/options/webobjects-dev/alexis.tual%40gmail.com
>>>> 
>>>> This email sent to alexis.t...@gmail.com
>>> 
>> 
>> 
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/markm%40onpointsoftware.com
> 
> This email sent to ma...@onpointsoftware.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to