• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF page reload on select of selectBooleanCheckbox

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need to reload the JSF page on check/uncheck of selectBooleanCheckbox. If we had action attribute as we have in commandButton, we could have navigated it back to the same page. Can we use valueChangeListener to achieve this? if yes, then how?

Thanks in advance!

Regards,
Pushpa
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can do this onclick event of selectBooleanCheck box

like window.location = window.location;

this will refresh the page

venkat
 
venkata swamymora
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Otherwise write onselect event
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you write a value change listener for a check box it should look something like this:

public void handleCheckBoxChange( ValueChangeEvent valueChangedEvent) {
// Note, valueChangeEvent contains new and old values
Boolean projectStageChangeRequested = (Boolean)
valueChangedEvent.getNewValue();
// do some other things here....
}

The code an on Click handler for check box
on click="return checkProjectStageChange(this, event);"

and do this in javascript:

function checkProjectStageChange(thisObj, thisEvent) {

document.forms["addModifyProjectForm"].submit();
}
[ January 29, 2008: Message edited by: Bob Good ]
 
Pushpalatha Gowdra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your kind help.

I tried both options.

Option1:
window.location = window.location;
This is taking me to my first page, and not refreshing the current page, as at that time the URL was not set to current page.

Option2:
form.submit() is working fine, but its doing some mandatory field validation, which should be skipped for page refresh.

Is there any way to submit the form by skiping the validation?

Regards,
Pushpa
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To skip the Validation phase please apply imediate=true in your tag which will skip all the phases and submit the page in backing bean.
 
Pushpalatha Gowdra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Let me explain my problem in detail,

I have 2 command components in the form a selectBooleanCheckbox and a commandButton.

On submit from commandButton all fields should be validated, model values should be updated and response should be rendered. I mean it should follow complete request processing life cycle.

On click of selectBooleanCheckbox only the model values should be updated & the page should be reloaded (rendered again) to display the user entered values. Some fields are set to rendered=false if selectBooleanCheckbox is checked.

I have set immediate=true for selectBooleanCheckbox and calling form.submit on onclick event of selectBooleanCheckbox

so only for submit from selectBooleanCheckbox the validation should be skipped. please let me know how this can be achieved

Regards,
Pushpa
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic