Re: Re: How to get each CheckBox value inside a WORepetition Bind to the same variable
Re: Re: How to get each CheckBox value inside a WORepetition Bind to the same variable
- Subject: Re: Re: How to get each CheckBox value inside a WORepetition Bind to the same variable
- From: "Cheong Hee (Gmail)" <email@hidden>
- Date: Fri, 17 Jun 2011 17:26:34 +0800
Hi
I think what is missing is - for your onclick to work, you will need to add
a submit button and wrap in the woform.
For example, in wocheckbox, if you set the value to 5, and bind the
selection to isActive (an Integer). you will need to bind the onclick to
the following value:
CheckBoxTest : WOCheckBox {
value = 5;
selection = isActive;
onClick = "document.all('submitButton1').click();";
}
Then add your submit button as the following:
submitButton : WOSubmitButton {
action = doSubmit;
name = "submitButton1";
}
The onclick will call the submit button, and return the value=5 (if it is
checked) to your component page. Passing the value to the next page will be
easy then.
Hope it helps.
Cheers
Cheong Hee
----- Original Message -----
From: email@hidden
To: Mark Morris ; Chuck Hill ; WebObjects webobjects-dev
Sent: Friday, June 17, 2011 4:05 PM
Subject: Re: Re: How to get each CheckBox value inside a WORepetition Bind
to the same variable
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 (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
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