Using an expression to set checkbox value

Hi,
I am working on an application that has a whole suite of javabeans where boolean fields are expressed as Y/N flags. Regardless of whether or not this is a good idea, that is how it is and I cannot change them (it came about because the beans map straight to database tables that do not accept Boolean datatypes).
I am wanting to render these fields as checkboxes, ideally so that they can be properly bound to a backing bean, but it would suffice if I could just display the checkbox and have it only readonly (doesn't have to map back to the backing bean).
I have tried to write a converter to handle these fields, but MyFaces doesn't like having a non-boolean binding for the field, even with the converter supplied.
To just try and render the non-editable checkbox I would to be able to do the following:
<h:selectBooleanCheckbox value="#{group.external == 'Y'}" />This works fine when the page is displayed, but it still tries to update the model when the form is submitted and throws the following exception:
javax.faces.el.EvaluationException: Cannot set value for expression '#{group.external == 'Y'}' to a new value of type java.lang.Boolean
Any ideas would be appreciated...

I suggest it: on your JSF managed bean wrap your String value.
String strExternal;
public boolean isExternal () {
   boolean f =  "Y".equalsIgnoreCase(strExternal);
   return f;
public void setExternal(boolean f) {
this.strExternal =  (f ? "Y" : "N");
}Internally you work with Stirng values, however MyFaces with booleans.

Similar Messages

  • Using Auto Suggest To Set The Value Of Multipe Form Fields

    I would like to use the Spry 1.5 Preview Auto Suggest widget
    to provide the value for multiple form fields based on the row the
    user selects in the auto suggestion data set. I've placed an
    example of what I want to do here:
    http://www.brucephillips.name/spry/Spry_P1_5_Preview/autosuggest/autosuggestMultipleFields .cfm
    It appears that when the user clicks on one of the rows in
    the auto suggestion data set, the current row for the data set is
    not updated but remains the default (first row in the data set).
    Therefore, if you have a spry:detailregion that uses that data set,
    the values for that detail region are from the first row in the
    data set and not the row the user selected.
    Is it possible to set the current row of the auto suggest
    data set to the row the user clicked on in the auto suggestion data
    set so that the spry:detailregion will have the values from the row
    the user clicked on?
    I had previously modified the Spry 1.4 Auto Suggest widget to
    do this. See:
    http://www.brucephillips.name/blog/index.cfm/2006/11/6/Modifing-Sprys-Auto-Suggest-Widget- to-Bind-Users-Selection-to-A-Form
    Thank you for any assistance.

    Cristian: thank you for the reply. I understand your concern
    about the user changing the auto suggest field after updating the
    complimentary fields. I think that could be handled through user
    instruction. Additionally, instead of using form fields to hold the
    complimentary data I could use non-editable paragraphs.
    I hope the change is not too difficult. I think this
    modification would make the auto suggest widget even more useful.
    For example think about a product auto suggest. User starts to type
    in the name of the product, selects the full product name from the
    auto suggestions, and now the page can immediately show in a
    spry:detailregion all the product details.
    Thanks again for considering my request. I really appreciate
    all the work the Spry team is doing. I'm looking forward to the
    official release of Spry.

  • How to Set CheckBox values in Before Headr Process

    In my Before Header process I read a database table that contains a code field that I would like to use to have my checkbox values checked if the field contains one of the values.
    Example the database file my have "LWR"
    On the form the Check box is
    L - For Loading
    W - For Waiting
    R - Relase
    P - Posted
    J - Job
    .....etc
    So when I read the record for my above example I would like L, W, and R checked.
    What is the best method to do this?
    THanks.

    Are you storing the values with their ":" separators (like 'L:W:R')?  If so, the checkbox code does the transformation logic.  In which case, there is no need to code insertion of the : when populating the checkbox.  No need to remove them before saving the values.
    Howard

  • Using Airport Express to set up an ad hoc network for presentations

    I have to give a presentation where I will both need my MacBook Pro and iPad. I may or may not have a wireless network available (will depend on location). Is there a way that I can use an Airport Express to set up an ad hoc network and use an Apple TV for AirPlay from my iPad and laptop?

    Easy to do. Just set up the AirPort Express to "Create a wireless network".
    When you see the "error" message(s) that there is not an Ethernet cable plugged into the WAN port and/or no Internet connection, click "ignore" and you will have a green light on the Express.
    Wireless devices will connect to the network by selecting it and entering the password.

  • Setting Checkbox value

    Hi, very new to Formcalc. I have a simple question: I have two check boxes and if I set one I want to un-set the other. I know Radio buttons do this but I need to use check boxes. My code that is being thrown out is:
    if (BookingMatrix.Row1.CheckBox[0]==1) then BookingMatrix.Row1.CheckBox[1]=0
    I have also tried .value & .rawvalue, neither seem to work. The error I get is "syntax error near token "0"
    Can anyone help, please:-)

    Try this.
    Using Javascript. Under change, put these for your checkboxs. Rename appropriately.
    Checkbox1
    if (this.rawValue == "1") {
      this.resolveNode("CheckBox1").rawValue = "0";
    Checkbox2
    if (this.rawValue == "1") {
      this.resolveNode("CheckBox2").rawValue = "0";

  • Using radio buttons to set the value of a text field

    I have a set of three radio buttons on a form (a performance evaluation). If I select the "1" button, I want 1 to populate in the text field. The same goes for "2" and "3"
    I have not been able to code the buttons correctly for this scenario, and can't figure out how to do it.
    From a previous post, I was able to get check boxes to do what I want, but they won't really work because I can't set them so that only one back may be selected.
    Can this be done?
    Thanks!

    The information for this specific case isn't anywhere. The best that you can do is understand what triggers each of the events, then ask yourself which of those triggers are pertinent to your current issue.
    http://help.adobe.com/en_US/livecycle/es/LiveCycle_Designer_Scripting_Basics.pdf ...
    The above link contains a great deal of information regarding how to use scripts within Livecycle Designer. The section that you would be most interested in in order to learn about the available events can be found under "Events >> List of Events".
    You needed to use the initialize event so that the text field would be updated when the document was opened. This ensure that the text field has the value of the default radio button when it is opened for the first time.
    You needed to use the change event so that, when the use selects a different radio button, the text field is updated with the new value.
    That's about it. That PDF file that I link to above is a bit long, but it's a great place to get a good grasp of the basics of scripts.
    If you have any further questions, feel free to ask. =) Have a good one.
    - Scott

  • Using groovy expressions to get a value of the current row

    Hi,
    I have a bounded task flow. The first step in the flow is calling an ExecuteWithParameters on one of my views. Based on the result of this query, I want to go to either Page1 or Page2.
    So I have a router. I first tried to route based on whether or not the result of the query contained only one row. That worked fine. But I want to add a condition to that.
    Basically, if the query returns one row AND that row has an attribute named 'Noc' == 1, then I want to go to Page2. Otherwise, go to Page 1.
    Right now to get the estimatedRowCount I am getting the iterator from the pageDef file created for my ExecuteWithParams object. To see if 'Noc' == 1, I tried this:
    #{data.rcl_view_reimbCode_search_results_task_flow_reimbCode_search_results_task_flow_ExecuteWithParamsPageDef.ReimbCodeSearchView1Iterator.currentRow.getAttribute("Noc") == 1}
    But it is complaining of grammar issues.
    What is the best way to go about getting the value of my attribute in a groovy expression?
    Thanks,
    Joel

    Hi,
    the best way is to use a managed bean reference
    1. create a binding for the router
    2. Expose the queried iterator in the PageDef file
    3. write a managed bean that accesses the binding
    BindingContext bctx = BindingContext.getCurrent();
    BindingContainer bindings = bctx.getCurrentEntry();
    DCIteratorBinding iter = bindings.get("NameOfIterator");
    // i) get estimated row count
    // ii) get attribute value
    //iii) evaluate
    // iv) return true/false
    Reference the managed bean from the router
    Frank

  • Using a trigger to set default values

    Hi
    Does anyone know of a way to set a default value of a column in Oracle trigger code? I am trying to write an on Update trigger to set the default value of a column in a relationship when the parent is updated.
    Thanks
    Mike

    Solution :
    Suppose you have 2 tables, Emp and Dept,
    In this case Dept is parent and emp
    is child.
    So if you update parent (change deptno
    from 20 to 21 , then you want the same
    to be reflected in emp table i-e all the
    record in emp table having the deptno as 20
    now should have 21.
    Create trigger upd_emp
    after update on dept
    begin
    update emp
    set deptno = :new.deptno
    where deptno = :old.deptno;
    end;
    Hope this helps
    Naresh
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Mike D ([email protected]):
    Hi
    Does anyone know of a way to set a default value of a column in Oracle trigger code? I am trying to write an on Update trigger to set the default value of a column in a relationship when the parent is updated.
    Thanks
    Mike<HR></BLOCKQUOTE>
    null

  • Use $PROFILES$.MFG_ORGANIZATION_ID to set DFF values in eAM Self Service

    Hi all, I try to set the Reference field for the DFF (Application: Work in Process, Title:Work Request Information), with "$PROFILES$.MFG_ORGANIZATION_ID".
    This flexfield is for Self service of maintenance OA Framework. This configuration that work in forms, doesn't work in web application.
    What is the correct way to do this?
    Thanks

    Hi all, I try to set the Reference field for the DFF (Application: Work in Process, Title:Work Request Information), with "$PROFILES$.MFG_ORGANIZATION_ID".
    This flexfield is for Self service of maintenance OA Framework. This configuration that work in forms, doesn't work in web application.
    What is the correct way to do this?
    Thanks

  • How do I retain a PDF form widget's design when setting its value using Javacript in Acrobat?

    I've been experimenting with interactive PDF forms in InDesign and JS in Acrobat. I think I've encountered something that might be a bug: widget design is overriden when using Javascript to set the field's value in Acrobat. Here's what a checkbox, for example, should look like when checked:
    However performing:
    var f = this.getField("Checkbox");
    f.value = "Yes";
    in the JS Console results in the widget's appearance defaulting to acrobat's:
    I've tried every single widget property documented in Acrobat's Javascript API Reference to no avail. Initially, checking/unchecking using the mouse works fine. Once the value has been set using JS, Acrobat's default black check character is used for all subsequent toggling, including when using the mouse...
    How does InDesign export interactive PDFs with custom icons for widgets? Is there any way to enforce the use of those icons using JS in Acrobat Pro? What's the difference between selecting a checkbox or a radio button using the mouse and setting its value using JS?

    I thought it might be the case, too, but all widgets have the same properties both before and after setting the value with JS. I did this check using all documented properties in Acrobat JS Reference in an attempt to figure out what might be going on.
    By the way, I don't think Indesign necessarily uses glyphs for the checked state of widgets, although in this case a glyph is used (albeit with different stroke and fill colours for the glyph, acrobat doesn't allow setting these properties AFAIK). With Indesign CS6 it seems you can practically use any Indesign tool to design the widget's On and Off states. So I'm thinking that maybe Indesign exports these with button-like properties where there are no restrictions on appearance (I think there is an "icon" property/object for buttons or something like that). However Acrobat treats them as checkboxes, so if that is the case it is more of a hack. Is there a way to probe an object's various properties other than using JS or the properties pop-up dialog?

  • Set checkbox session state using Jquery / dynamic action

    Hello Folks,
    I'm trying a simple dynamic action to disable & set element value upon making a radio box selection.
    What I'd like is:
    a) if i chose "Vendor" as "Traditional" (default value) I would like to set the "SNAP" flag as Checked and "Status" textbox to "test for static value" (SNAP flag is not set, only works on Page load)
    b) if i chose "vendor" as "Isilon" then "SNAP" flag should be greyed out (disabled) and "Status" textbox should be disabled. (Working as Expected)
    Link to the page:
    http://apex.oracle.com/pls/apex/f?p=73069:6:0::NO:::
    Workspace: wksp_chandu
    Username: test
    Password:test
    Dynamic Action
    Identification
    Page:
    6. Check Disable radio
    *Name(Value Required)
    *Sequence(Value Required)
    When
    *Event(Value Required)
    - Select Event -
    Change
    Click
    Double Click
    Get Focus
    Key Down
    Key Press
    Key Release
    Lose Focus
    Mouse Button Press
    Mouse Button Release
    Mouse Enter
    Mouse Leave
    Mouse Move  Page Load
    Page Unload
    Resize
    Resource Load
    Scroll   Select          
    After Refresh
    Before Page Submit
    Before Refresh
    Change Order [Shuttle]
    Custom
    Show unsupported...
    *Selection Type(Value Required)
    - Select Selection Type -
    Item(s)
    Button
    Region
    DOM Object
    jQuery Selector
    *Item(s)(Value Required)
    Condition
    - No Condition -
    equal to
    not equal to
    greater than
    greater than or equal to
    less than
    less than or equal to
    is null
    is not null
    in list
    not in list
    JavaScript expression
    *Value(Value Required)
    True Actions
    The following actions will be fired when the 'When' condition is met, or when it is 'No Condition'.
    Edit
    Sequence
    Action
    Fire On Page Load
    Selection Type
    Affected Elements
    10
    Clear
    Yes
    Item(s)
    P6_SNAP
    P6_STATUS
    20
    Disable
    Yes
    Item(s)
    P6_SNAP
    P6_STATUS
    Add True Action
    False Actions
    The following actions will be fired when the 'When' condition is not met.
    Edit
    Sequence
    Action
    Fire On Page Load
    Selection Type
    Affected Elements
    10
    Enable
    Yes
    Item(s)
    P6_SNAP
    P6_STATUS
    30
    Set Value
    Yes
    Item(s)
    P6_STATUS
    40
    Execute JavaScript Code
    No
    Item(s)
    P6_SNAP
    Add False Action
    Thanks!
    Chandu

    Oops...I just got it working.. Thanks for your time. I was trying to set checkbox value via javascript code and somehow that wasn't working...Finally changed the setvalue to be based on "PL SQL expression" nvl(:P6_SNAP,1)...that seem to have worked.
    Thanks again !

  • How to get year value using regular expression

    Hi,
    I have a different format of date such as 2004-01-03, 2003/01, 05/06/2005, 06-05-2007
    How can I get only the year value using regular expression? The year value is always in 4 digits
    Thanks in advance

    sabre150 wrote:
    JosAH wrote:
    \d{4}Is this the Jos I knew who poured scorn on anything to do with regex? Is this the Jos I knew who said that the 'pimping lemon' stopped regex being of any real use?It wasn't me; honest, I'm innocent: one of my parrots walked over my keyboard; I wouldn't be able to type such nonsense; naughty parrot! No cookie!
    kind regards,
    Jos
    ps. regexes can only survive the baby-pumping-lemma; they all die a horrible death with the real-men-pumping lemma! So there.

  • HOW to set the value attribute of FORM INPUT data to a variable in a JSP

    eg. Registration.jsp
    The data is accessed from an hidden field called course
    for example, if I have "Java programming" in the field course, and I use
    an expression to access the value from the hidden field.
    **My problem is that the data gets truncated to "Java" , I need "Java Programming"to display. The code looks like this
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <INPUT TYPE="text" SIZE=12 NAME="course"
    VALUE=<%=getParameter("course") %>
    IS there ANY OTHER WAY to set the value of VALUE to a variable?

    Instead of value=<%=request.getParameter("course")%>
    Use double codes
    value="<%=request.getParameter("course")%>"

  • Requirement to update a column by using Regular Expression

    Hi All,
        I have a requirement to update a column which is having values like below code.
    based on the conditinos I need to update from ‘E’ to ‘Z’.  Few positions I need to update and remaining positions I need leave as it is.
    How I can achive this requirement by using regular expression regexp_replace.
    Actual value --> 'AEAAAEAA    EE    AA    EE    AA    EE    EEEAA    AA    AA       '
    After update -->  'AZAAAZAA    EE    AA    EE    AA    EE    EEEAA    AA    AA       '

    below is my requirement. I am adding the conditions dynamically as per the conditions. I dont know the position of the E. If 'E' is in any position I need to update with 'Z' if that 'E' satisfy the condition.
    I dont want to update all the E's to Z's.
    I want to update specific E's which satisfy the condition.
        IF l_kwhhilow >= 1 THEN
            l_where := l_where||' SUBSTR(OVERRIDEFIELD,1,1) = ''E'' OR ';
            l_exp := l_exp||'Z';
        ELSE
            l_exp := l_exp||'\1';
        END IF;
        IF l_kwhilow >= 1 THEN
            l_where := l_where||' SUBSTR(OVERRIDEFIELD,2,1) = ''E'' OR ';
             l_exp := l_exp||'Z';
        ELSE
            l_exp := l_exp||'\2';
        END IF;
        IF l_kvahilow >= 1 THEN
            l_where := l_where||' SUBSTR(OVERRIDEFIELD,3,1) = ''E'' OR ';
             l_exp := l_exp||'Z';
        ELSE
            l_exp := l_exp||'\3';
        END IF;
        IF l_kvarhilow >= 1 THEN
            l_where := l_where||' SUBSTR(OVERRIDEFIELD,4,1) = ''E'' OR ';
             l_exp := l_exp||'Z';
        ELSE
            l_exp := l_exp||'\4';
        END IF;
        IF l_todkwh1hilow >= 1 THEN
            l_where := l_where||' SUBSTR(OVERRIDEFIELD,5,1) = ''E'' OR ';
             l_exp := l_exp||'Z';
        ELSE
            l_exp := l_exp||'\5';
        END IF;
        IF l_todkwh2hilow >= 1 THEN
            l_where := l_where||' SUBSTR(OVERRIDEFIELD,6,1) = ''E'' OR ';
             l_exp := l_exp||'Z';
        ELSE
            l_exp := l_exp||'\6';
        END IF;
        l_exp := ''''||l_exp||'''';
        l_exp1 := '\1\2\3\4'||l_exp1;
        IF l_todkw1hilow >= 1 THEN
            l_where := l_where||' SUBSTR(OVERRIDEFIELD,11,1) = ''E'' OR ';
             l_exp1 := l_exp1||'Z';
        ELSE
            l_exp1 := l_exp1||'\5';
        END IF;
        IF l_todkw2hilow = 1 THEN
            l_where := l_where||' SUBSTR(OVERRIDEFIELD,12,1) = ''E'' OR ';
             l_exp1 := l_exp1||'Z';
        ELSE
            l_exp1 := l_exp1||'\6';
        END IF;
        l_exp1 := ''''||l_exp1||'''';
    IF i give 10 in the regexp_replace it is not working.
    SET OVERRIDEFIELD =     REGEXP_REPLACE(SUBSTR(overridefield,1,6), ''(.)(.)(.)(.)(.)(.)'','||l_exp||')'||
                                              ' ||REGEXP_REPLACE(SUBSTR(overridefield,7,6), ''(.)(.)(.)(.)(.)(.)'','||l_exp1||')'||
                                              ' ||SUBSTR(overridefield,13)'||

  • How to set the value in the xml node.

    Hi
    I am having the application PDF which can be submitted by user using the button. while submitting 
    i am using below code to set the value in the xml node.
       xfa.data.assignnode("employee.id","123",0):
    So its generating the xml like below.
    <employee>.
    <id>123</id>.
    </name>
    </employee>
    Now i need to generate the xml like  below.
    <employee id= "123" >
      </Name>
    </employee>
    So how to set/create the id node like above?
    Advance Thanks.
    Regards,
    Dhiyane

    Hi Dhiyane,
    You will have to set the contains property if the id node to "metaData", that is;
    xfa.data.assignNode("employee.id","123",0);
    xfa.data.employee.id.contains = "metaData";
    Very clumsy if you have a number of them, in which case you might want to look at using E4X.
    Good luck
    Bruce

Maybe you are looking for