Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter an af:outputText Value via af:selectBooleanCheckbox action

Status
Not open for further replies.

DairylandDan

Programmer
Apr 3, 2008
17
US
So, here's my question (with slight 'setup'):

I have an af : outputText which gets it's value set to a date value (slightly altered via af:convertDateTime to remove the "/" seperators) on page load:

Code:
             <af:outputText value="#{AppInfo.paydateInLockout}"
                            binding="#{backing_apps_payroll_upload.outputTextBatchNum}"
                            id="outputTextBatchNum"
                            partialTriggers="selectBooleanCheckboxYearEndFirstRun">
              <af:convertDateTime dateStyle="short" pattern="MMddyy"/>
             </af:outputText>
I want a check box on the page (I'm trying an af:selectBooleanCheckbox) which, if checked, will change the outputText value to the final date of the previous year. If unchecked, it will return to the original value.

So, I thought that I could try some sort of 'value change listener' backing bean code sort of scenario like so . . .

Within the .jspx page:

Code:
<!-- outputText -->
             <af:outputText value="#{AppInfo.paydateInLockout}"
                            binding="#{backing_apps_payroll_upload.outputTextBatchNum}"
                            id="outputTextBatchNum"
                            partialTriggers="selectBooleanCheckboxYearEndFirstRun">
              <af:convertDateTime dateStyle="short" pattern="MMddyy"/>
             </af:outputText>
.....
<!-- selectBooleanCheckbox -->
            <af:selectBooleanCheckbox text="#{resources['etsUpload.SelectYearEndFirstRun']}"
                                      binding="#{backing_apps_payroll_upload.selectBooleanCheckboxYearEndFirstRun}"
                                      id="selectBooleanCheckboxYearEndFirstRun"
                                      selected="false" styleClass="dpc"
                                      autoSubmit="true"></af:selectBooleanCheckbox>
.....
Then, in the backing bean, something like so:

Code:
 public void actionListenerYearEndFirstRunCheckChange(ActionEvent action) {
  if(selectBooleanCheckboxYearEndFirstRun) {
   //The selectBooleanCheckboxYearEndFirstRun has been CHECKED - set the Batch Number to "1231xx"; where "xx" equals Pay Period End Date Year (#{AppInfo.paydateInLockout}) minus one (1).
   outputTextBatchNum.setValue("123109");
  }else{
   //The selectBooleanCheckboxYearEndFirstRun has been UNCHECKED - set the Batch Number to the same value as Pay Period End Date (#{AppInfo.paydateInLockout}).
   outputTextBatchNum.setValue(#{AppInfo.paydateInLockout});
  }
 }
Don't worry about the "123109" value . . . right now I'm simply trying to make ANY change happen to the outputText. LOL!

Obviously, I'm missunderstanding something very basic about Java, the valuechangelistener scenario and the way to correctly work my backing bean code (as I am a beginner) . . . so, I really don't quite know how to proceed or where to look for a better suggested solution (even having spent many many, way TOO MANY, hours on Google)

I did a 'search' here and found no references to selectBooleanCheckbox.

Any assistance would be grealy appreciated.

DLD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top