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 51909 articles. 38 followers. Post

2 Replies
714 Views

Similar Articles

[PageSpeed] 30


  • 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...

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 = ...

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...

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()" /></...

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 ...

Checkboxes: Setting POST values if unchecked
I have a form with a checkbox: <form method="post" action="test.php"> <input type="checkbox" name="foo" checked> <input type="submit"> </form> If the checkbox is checked, $_POST['foo'] gets assigned the value "on" (using php as the second file) But if the checkbox is unchecked, $_POST['foo'] is not assigned. Is there a simple way that I can set an arbitrary value to this (eg."off"), if the checkbox is not checked? An onClick method for the submit button would be a good start. I&#...

Using checkbox to change dropdown lists
I am trying to create a timecard that has a checkbox that the user can check if they worked normal hours that will change the dropdown lists for that day to a standard workday in order to save the time. I can get it to work if I hard code the select names, but I am going to have the form display 5 days at a time and I can't figure out how to make it work when I have multiple days displayed. Here is my code that I made for the hard-coded version. I just can't figure out how to work with the variable. Hopefully someone can help me. <script language='javascript'> function st...

Trigger checkbox when combo box is changed
I have a PDF form that has a combo box "no_wireless_mics" with the values "1" "2" and " " where " " is the default. I need a JavaScript that will cause the check box "wireless_mics" to be checked (value=true) when the combo box value is "1" or "2" I ama JavaScript newbie and I'm having quite a time figuring this out. Thank you for your time and attention. "Jason McDonald" <jmcdonald@nyc.rr.com> wrote in message news:5cfb4113.0309150717.5d8aaef9@posting.google.com... > I have a PDF form that...

Change the contents of a combo through a checkbox selection
Dear friends, I have a form in wich there are two check boxes and a combo as shown bellow: <form> <input type="checkbox" name="check1" checked>Tipo 1 <input type="checkbox" name="check2" checked>Tipo 2 <br> <select name="combo"> <option value="1">item 1</option> <option value="2">item 2</option> </select> </form> I'd like to change the contents of the combo by changin the selection in the checkboxes. I tried putting "onclick" events to b...

changing checkbox handle at GUI startup
I currently have a GUI with a bunch of inputs (some of which are checkboxes). I save all of the GUI input variables into a .mat file when I exit the GUI and load them back up when I start the GUI up. I found it easy to edit the handles for text input boxes but can't see a good way to do this for checkboxes because a checkbox doesn't have a create function which gets called upon GUI startup (like the text input boxes do). Is there an easy way around this? Thanks in advance. Anyone have any ideas? Thanks! I figured out that I can force a create function by putting it in the property ma...

How to change the default for radio, checkbox and button?
By default the radio button is a hollow circle for unchecked and filled black circle for checked similar for the check box button is a hollow square for unchecked and check symbol for checked. I would like use two images jpeg or gif for unchecked and checked. I try CSS by input[type="radio"] { background-image: url(myimage.gif); background-repeat: no-repeat; background-position: right center; } input[type="checkbox"] { background-image: url(myimage.gif); background-repeat: no-repeat; background-position: right center; } But they are not wo...