Strange behavior with checkboxes in subcomponent
Strange behavior with checkboxes in subcomponent
- Subject: Strange behavior with checkboxes in subcomponent
- From: Marcos Trejo Munguia <email@hidden>
- Date: Fri, 21 Oct 2005 10:46:39 -0500
Hi list
I'm having a problem with a reusable component, this component shows a list of items and you can select from 1 to n of them with a checkbox next to each item. Here is the code:
//Array with the selected items, this is initiallited by the parent component
protected NSMutableArray receptionsSelected;
//Item for WORepetion(Items to select)
protected POReceptionDetail receptionItem;
//Cancell callback
protected String cancelCallback;
//Submit callback
protected String submitCallback;
The next methods are bound to the checked binding of the checkboxes
protected boolean checked() {
return receptionsSelected.containsObject(receptionDetailItem);
}
protected void setChecked(boolean isItChecked) {
boolean wasItChecked = checked();
if(isItChecked && !wasItChecked) {
receptionsSelected.addObject(receptionItem);
}
else if(!isItChecked && wasItChecked) {
receptionsSelected.removeObject(receptionItem);
}
}
I have this method to select all Items:
protected void selectAll() {
Enumeration i = po.poReceptionsOpen().objectEnumerator();
while (i.hasMoreElements()) {
POReceptionDetail iterator = (POReceptionDetail) i.nextElement();
if (!receptionsSelected.containsObject(iterator)) {
receptionsSelected.addObject(iterator);
}
}
}
Callback methods, this are bound to the action binding of a WOActiveImage respectively:
protected void cancel() {
performParentAction(cancelCallback);
}
protected void submit() {
performParentAction(submitCallback);
}
Here is the submit parent action:
public void submitSelection() {
if (receptionsSelected.count() == 0) {
errMsg = "There are no receptions selected";
}
else {
stepController = 3;
}
}
Here comes the odd thing, if I select all items with selectAll and then I deselect all and click submit, the selection doesn't disappear, but if I change the WOActiveImage of submit to a WOSubmitButton everything works fine.
Please somebody give me a clue, what I'm doing wrong?
_______________________________________________
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