Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF page reload on select of selectBooleanCheckbox

 
Pushpalatha Gowdra
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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
 
venkata swamymora
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Otherwise write onselect event
 
Bob Good
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
Praful Sinha
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic