On selectonemenu change uncheck checkbox - JSF/RichFaces

  • Permalink
  • submit to reddit
  • Email
  • Follow


I have to uncheck a selectBooleanCheckbox lower down in the form IF it
is checked.

So I added the showOnWebAjx id to the reRender shown below.

<h:selectOneMenu id="estatus" value="#{itemHome.instance.estatus}"
    required="true">
    <f:selectItems id="estatuses"
        value="#{mconsoleContext.ecometryItemStatusCodes}" />
    <a:support event="onchange"
        reRender="showOnWebAjx, ecycleWeeksAjx, orderSizeFoodPoAjx,
upcAjx, kitAjx, preOrderAjx, priorityProcessingAjx"
 
actionListener="#{itemHome.resetPreOrderAndPriorityProcessingFlag}"
        ajaxSingle="true" />
</h:selectOneMenu>


I don't know how to uncheck the box but with the below code I can tell
when it is C1 or H1 (2 of the values where we want to uncheck the box,
the rest of the time we do nothing)

<s:decorate id="showOnWebFlagDecoration"
    template="/layout/edit.xhtml">
    <ui:define name="label">#{messages.showOnWebFlag}</ui:define>

<a:outputPanel id="showOnWebAjx">

<c:if test="#{'C1' eq itemHome.instance.estatus || 'H1' eq
itemHome.instance.estatus}">UNCHECK showOnWebFlag!!</c:if>

    <h:selectBooleanCheckbox id="showOnWebFlag"
        value="#{itemHome.instance.showOnWebFlag}"/>

</a:outputPanel>

</s:decorate>



The a:outputPanel and c:if test are my additions.

What is the proper / correct way to uncheck that box using JSF and/or
RichFaces?
0
Reply Danjojo 9/7/2010 1:19:32 PM

See related articles to this posting


On Sep 7, 9:19=A0am, Danjojo <dlcac...@gmail.com> wrote:
> I have to uncheck a selectBooleanCheckbox lower down in the form IF it
> is checked.
>
> So I added the showOnWebAjx id to the reRender shown below.
>
> <h:selectOneMenu id=3D"estatus" value=3D"#{itemHome.instance.estatus}"
> =A0 =A0 required=3D"true">
> =A0 =A0 <f:selectItems id=3D"estatuses"
> =A0 =A0 =A0 =A0 value=3D"#{mconsoleContext.ecometryItemStatusCodes}" />
> =A0 =A0 <a:support event=3D"onchange"
> =A0 =A0 =A0 =A0 reRender=3D"showOnWebAjx, ecycleWeeksAjx, orderSizeFoodPo=
Ajx,
> upcAjx, kitAjx, preOrderAjx, priorityProcessingAjx"
>
> actionListener=3D"#{itemHome.resetPreOrderAndPriorityProcessingFlag}"
> =A0 =A0 =A0 =A0 ajaxSingle=3D"true" />
> </h:selectOneMenu>
>
> I don't know how to uncheck the box but with the below code I can tell
> when it is C1 or H1 (2 of the values where we want to uncheck the box,
> the rest of the time we do nothing)
>
> <s:decorate id=3D"showOnWebFlagDecoration"
> =A0 =A0 template=3D"/layout/edit.xhtml">
> =A0 =A0 <ui:define name=3D"label">#{messages.showOnWebFlag}</ui:define>
>
> <a:outputPanel id=3D"showOnWebAjx">
>
> <c:if test=3D"#{'C1' eq itemHome.instance.estatus || 'H1' eq
> itemHome.instance.estatus}">UNCHECK showOnWebFlag!!</c:if>
>
> =A0 =A0 <h:selectBooleanCheckbox id=3D"showOnWebFlag"
> =A0 =A0 =A0 =A0 value=3D"#{itemHome.instance.showOnWebFlag}"/>
>
> </a:outputPanel>
>
> </s:decorate>
>
> The a:outputPanel and c:if test are my additions.
>
> What is the proper / correct way to uncheck that box using JSF and/or
> RichFaces?

Set the corresponding backing bean property to 'false'.

--
Lew
0
Reply lew (2468) 9/7/2010 2:26:46 PM

On Sep 7, 10:26=A0am, Lew <l...@lewscanon.com> wrote:
> On Sep 7, 9:19=A0am, Danjojo <dlcac...@gmail.com> wrote:
>
>
>
> > I have to uncheck a selectBooleanCheckbox lower down in the form IF it
> > is checked.
>
> > So I added the showOnWebAjx id to the reRender shown below.
>
> > <h:selectOneMenu id=3D"estatus" value=3D"#{itemHome.instance.estatus}"
> > =A0 =A0 required=3D"true">
> > =A0 =A0 <f:selectItems id=3D"estatuses"
> > =A0 =A0 =A0 =A0 value=3D"#{mconsoleContext.ecometryItemStatusCodes}" />
> > =A0 =A0 <a:support event=3D"onchange"
> > =A0 =A0 =A0 =A0 reRender=3D"showOnWebAjx, ecycleWeeksAjx, orderSizeFood=
PoAjx,
> > upcAjx, kitAjx, preOrderAjx, priorityProcessingAjx"
>
> > actionListener=3D"#{itemHome.resetPreOrderAndPriorityProcessingFlag}"
> > =A0 =A0 =A0 =A0 ajaxSingle=3D"true" />
> > </h:selectOneMenu>
>
> > I don't know how to uncheck the box but with the below code I can tell
> > when it is C1 or H1 (2 of the values where we want to uncheck the box,
> > the rest of the time we do nothing)
>
> > <s:decorate id=3D"showOnWebFlagDecoration"
> > =A0 =A0 template=3D"/layout/edit.xhtml">
> > =A0 =A0 <ui:define name=3D"label">#{messages.showOnWebFlag}</ui:define>
>
> > <a:outputPanel id=3D"showOnWebAjx">
>
> > <c:if test=3D"#{'C1' eq itemHome.instance.estatus || 'H1' eq
> > itemHome.instance.estatus}">UNCHECK showOnWebFlag!!</c:if>
>
> > =A0 =A0 <h:selectBooleanCheckbox id=3D"showOnWebFlag"
> > =A0 =A0 =A0 =A0 value=3D"#{itemHome.instance.showOnWebFlag}"/>
>
> > </a:outputPanel>
>
> > </s:decorate>
>
> > The a:outputPanel and c:if test are my additions.
>
> > What is the proper / correct way to uncheck that box using JSF and/or
> > RichFaces?
>
> Set the corresponding backing bean property to 'false'.
>
> --
> Lew

Like this?

	public void resetShowOnWebFlag(ActionEvent ae){
		String status =3D getInstance().getEstatus();
		if ("C1".equals(status)	|| "H1".equals(status)) {
			getInstance().setShowOnWebFlag(false);
		}
	}
0
Reply dlcacuff (5) 9/7/2010 2:56:04 PM
comp.lang.java.programmer 51973 articles. 38 followers. Post

2 Replies
763 Views

Similar Articles

[PageSpeed] 56


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Checkbox problem
Hello, I am having a problem in my struts application with the checkboxes in my form. I have an array of checkboxes, some of which may be already selected when the form loads. My problem is when the user then deselects one or more of these checkboxes and submits the form - they're being submitted as if they were still checked, when the user has infact deselected them. I've heard that this is a common problem, but I don't seem to be able to find the problem / resolution with any search criteria. If anybody knows the fix for this it would be greatly appreciated (if there is a solut...

Checkbox problem
Hello, I am having a problem in my struts application with the checkboxes in my form. I have an array of checkboxes, some of which may be already selected when the form loads. My problem is when the user then deselects one or more of these checkboxes and submits the form - they're being submitted as if they were still checked, when the user has infact deselected them. I've heard that this is a common problem, but I don't seem to be able to find the problem / resolution with any search criteria. If anybody knows the fix for this it would be greatly appreciated (preferably without ...

Checkbox problem
Hello, I am having a problem in my struts application with the checkboxes in my form. I have an array of checkboxes, some of which may be already selected when the form loads. My problem is when the user then deselects one or more of these checkboxes and submits the form - they're being submitted as if they were still checked, when the user has infact deselected them. I've heard that this is a common problem, but I don't seem to be able to find the problem / resolution with any search criteria. If anybody knows the fix for this it would be greatly appreciated (preferab...

Unchecking Checkboxes
I have 2 different links to the same function - one is just text and the other is a checkbox. I want to keep the checkboxes in synch with the rest of the form. For example, if a user clicks the 'Hide Company Board' text link below, I also want chkCompanyBoard within the frmCheckboxes form to to be unchecked. Thanks. function hideLayer(whichLayer) { document.getElementById(whichLayer).style.display = 'none'; var strshowhide=0; frmPanelStatus.location.href="panelstatus.asp?showhide=" + strshowhide + "&whichLayer=" + whichLayer; } <a href="jav...

Unchecking checkboxes
Is it possible to force a checkbox to be unchecked based on checking another checkbox? That is, when the user selects one option, I want to de-select other options... Thanks! Hi, set the Callback of each CheckBox object to : h=findobj(gcbf,'style','radio'); set(h,'value',0); set(gcbo,'value',1); or put all the CheckBox objects in a UiButtonGroup object : p=uibuttongroup('position',[.1 .1 .5 .5]); uicontrol('style','radio','parent',p,'position',[10 50 50 20]) uicontrol('style','radio','parent'...

Unchecking Checkbox
Thank you in advance for any and all assistance. It is GREATLY appreciated. I have a ckPrint box that is used to select print items. I would like to know, how I can programatically uncheck ALL the checkboxes, once all the selected records are printed? I would also like to know if there is a way to determine which records were printed, and offer a reprint option, if it's not too difficult? Thank you again, Michael Lumpierbritches wrote: > Thank you in advance for any and all assistance. It is GREATLY appreciated. > > I have a ckPrint box that is used to select print items. I w...

On submit checkbox member always null in ActionForm. Checkboxes display checked/unchecked properly on jsp/struts page.
Hi all: I am populating all fields in the ActionForm, and also populating an array of QueryResults from the data base. This bean called QueryResults has a field on it called selected. This QueryResults bean lives in the Actionform. Going out to the jsp, and returning on the execute(): All the data in the ActionForm, and the nestedbean:query results is populated properly except for one field and that is the big problem: checkbox member: QueryResults[1-'x'].selected <i>always</i> null in ActionForm. Here is the code. I dont konw what to do. Any suggestions? Here is my ...

jquery onchangeevent for a checkbox doen't fire imediately when user checks/unchecks. but it fires after user checks/unchecks and clicks outside an
The below code works fine but I am facing an issue like the check/ uncheck event doesnot fire imediately when the user checks/unchecks the checkbox. but fires only when after clicks outside anywhere on the page after he changes the checkbox selection. Please advice on what can I cahnge inorder to make it fire immediately when user changes the checkbox in below code: $(document).ready(function() { var pselect = "L"; $("#pLevel").change(function() { if ($("#pLevel").is(":checked")) { pse...

changing a checkbox value
I have a page that is database driven. The pages shows a user's name and whether they have access to our site or not. this is done by displaying two checkboxes positioned to the right of the users name. The first checkbox is to deny the user access and is named something like chkD followed by the user's id number from the database (ie; chkD20). The second checkbox is to allow the user access and is named chkA followed by the user's id number again (ie; chkA20). My question is how do I get only one checkbox checked at a time for each user. In other words, when the Allow checkbox(chk...

Checkbox Style Change
I've done quite a bit of research but I can't seem to find a solution so I'm hoping someone can help me here. I have a pdf file where a user needs to select a title (Mr, Mrs, Miss, etc). They need to be circled so I put checkboxes on top of them. However, the circle style is a filled one so it blocks the text. Is there a way to change this circle so it's not filled? From my research, it doesn't look like that's possible. So I think I can use a button where when it's pressed, a circle (it can be the capital letter O) will fill the box. I understand I can use J...

Trace on change/Signal on change/Call on change
Is ooRexx getting any closer to having a mechanism which could be used to trace when a particular variable or stem variable gets changed (to a particular value)? I don't know whether I'm writing cleverer bugs, or my debugging skills are waning with age, but it is starting to take me days to track down some problems that would be a snip with a variable monitor. I've just fixed such a bug. It took me about three years, because it happened only once a year, on average. Phew! -- Steve Swift http://www.swiftys.org.uk/swifty.html http://www.ringers.org.uk Swifty wrote: > Is ...

Detecting status change in a checkbox
I'm not really good with javascript, basically what I'm trying to do is that I want to be able to handle when the status of a checkbox is changed (i.e. checked or unchecked), I see everybody is using onclick but I wonder if this is the correct approach, what if a user changes the status of the checkbox using the keyboard, will onclick be triggered? I know I might sound a little picky here but I believe those people who created DHTML must've thought about this, right? Sorry if I posted the question in the wrong group, I couldn't find a good group for DHTML, I assume many people...

Change value of checkbox in uitable
Hello, I have a uitable element integrated in my GUI that uses checkboxes for the user interaction. I provide also one button that should set all these checkboxes to value 1 (= ticked). I have tried that by using the jtable function 'setValueAt' and it seems although the value is changed from 0 to 1, the checkbox doesn't appear as ticked. The checkboxes in the uitable are enabled using the command 'SetCheckboxEditor'. Is there any way of achieving the required functionality? Thanks for help, g. ...

Forms checkbox font changed
Nowhere in Acrobat help can I find the answer to this question: How do I ch= ange the font used for the checkmark in a checkbox? Recently my font on my = PC changed to what looks like a Comic Sans check (no sharp points), but my = users still see the default one. Problem is, they say the checks are now to= o low! How can I get the default font back? Reinstalling would be SUCH a ha= ssle (the company IT is slow and unreliable for apps). On Monday, September 24, 2012 6:13:17 PM UTC-7, Debra Ashcraft wrote: > Nowhere in Acrobat help can I find the answer to this question: How do I = ...

iTunes changed my changes
Don't know when it happened- could have been with the update of iTunes prior to the update of iOS7, but here's what happened: A few weeks ago, I changed the name of the four movements of a Mozart Symphony so that it would appear separately from the exact same symphony by another artist. This is the default which I had: Mozart: Symphony #41 In C, K 551, "Jupiter" - 1. Allegro Vivace which I changed to: Mozart: S41 In C, K 551, "Jupiter" - 1. Allegro Vivace The separation worked as expected. BUT: Somewhere, somehow the changes got reverted to what ...

Changes and frequency of changes
Hi, I observe variable x over time (from 1999-2005) for a large number of firms, w. I have computed the change in variable x from one year to the next. Now, I would like to identify whether variable x has changed from one year to the next for each firm as well as how often it changed for each firm(in some cases I expect no change in this variable i.e. 0). Any suggestions on how to do this in sas? Thanks On Sat, 28 Apr 2007 15:08:15 -0400, mcolowasth@YAHOO.CO.UK wrote: >Hi, > >I observe variable x over time (from 1999-2005) for a large number of >firms, w. I have computed the ...

use checkbox to change visibility
how do i use a checkbox ive created in matlab to change the visibility of a text box in my gui ? the following code does not seem to work thanks function checkbox1_Callback(hObject, eventdata, handles) % hObject handle to checkbox1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB %handles structure with handles and user data (see GUIDATA) if (get(hObject,'Value') == get(hObject,'Max')) %Checkbox is checked drawnow(); set(text14,'visible',['on']) uw = findobj('Tag','pushbutton6'); set(text15...

Unchecked checkbox
I'm not sure whether this question demands a JavaScript answer or a simple HTML one - so apologies for the cross posting. I am grabbing a bunch of data from MySQL using PHP and returning the results, row by row, to the user. These results are returned in a form (for editing) and then submitted back out again as an array (since the field names are repeated), e.g : <form type="text" name="subject[]"> <form type="checkbox" name="delete[]"> ... plus many others. My problem is that when the user makes the requested changes, and tic...

how to change the change defaults
hi friends, it might be a stupid question to state. but i really need to know while programming, to change the defaults like changing the engineering notation of a real quantity i.e. fraction values or change the fix parameters to denote real value if our calculations involve the values as low as 0.000000001 and as high as 10000000. thanks hemu bisht ...

Change a check mark in a checkbox
Hello all, I created a GUI with few checkboxes. Using the Property Inspector I set the value of few of them to 1. When I run the GUI checkboxes with value set to 1 appear with a check mark. I want to allow the user to use a 'Default' pushbutton which reset all the checkboxes to the initial values. I can change the value of each checkbox using the command: Set(handles.my_checkbox, 'value', new_value) But I can't make the check mark appear (or disappear). How can one do that? Please help, Utzli Utzli Gutzli wrote: > Hello all, > > I created a GUI with few check...

changing checkbox properties runtime
Is it possible to change the edit style type of a column checkbox for different rows at runtime depending on the desired display format? I am able to change the edit type, but it changes it for all the rows. I have also tried creating columns of different types and having them either hideor be not visible depending on the display format I require, but this too does it for all the rows rather than for each row. Thanks Allan ...

change color by clicking checkbox
Hi I have a html file as below. ==================================================================== <html> <head> <td style="background-color:rgb(170, 157, 244);"> <table border="0" cellpadding="5" cellspacing="2" width="95%"> <tr><td style="background-color:yellow" width="100%"> <table><tr style="font-size: 95%;"><td><input type="checkbox" name="" value="new" onclick="ShowDate()" /></...

DST to change or not to change?
Should the clocks be changed twice a year or not? (not that we have much say in the matter) Some think it saves lives by avoiding traffic accidents and note the advantages of a coordinated timekeeping system for trade. http://www.theglobeandmail.com/servlet/story/RTGAM.20050811.wdaylight0810/BNStory/National Since most of Canada is between north latitude 49 deg to 90 deg, and the days and nights are longer the further north you go, the arguments for saving daylight seem to be overwhelmed by the larger natural changes. OTOH DST is not needed at smaller latitudes in the tropics. ...

Checkbox changed by browser after running javascript
I have a form with a checkbox. Using MSIE, the user marks the checkbox, submits the form and gets his result. Then he uses the browsers back button to return to the form. Here I have a checkbox=document.getElementById('ch1'); alert(checkbox.status); This alert pops up and says "false". I can see that the checkbox is not activated. Then I click "ok" to the alert and then the checkbox is checked. I.e. the browser fills in the previous values _after_ javascript processing is done. How can I determine the checkbox status with javascript? JMS NnlGggTuqP...

Can you change the appearance of a radiobutton or checkbox?
Can you change the appearance of a radiobutton or checkbox? I do not mean the apearance changes from checked to not checked or disabled or not disabled, but change the appearance (of all these states) to a total different set of images defined by img files? Probably not I think? Reason is I want some checkboxes to look a bit different then the standard ones to implicitly say that these checkboxes have some special function. (Ok that's a bit vage, I know) In article <1133448809.114807.257690@g14g2000cwa.googlegroups.com>, marcwentink@hotmail.com says... > Can you change the ...