SelectBooleanCheckbox corresponding to a numeric db field

Hi all,
I am trying to use JSF (and Icefaces, but in this case I don't think this matters) to display and let users edit some info from a (MySQL) database. In my tables, I have various tinyint fields I use for boolean values. I want to display these in a form as checkboxes and be able to properly update the database upon select/deselect.
The problem I am encountering is with converting the boolean value to numeric. I first tried something like:
<h:selectBooleanCheckbox value="myBean.numValue != 0" converter="javax.faces.Byte"/>
thinking that the converter would convert the boolean value of the checkbox into byte when the form is submitted. This didn't work and I got type mismatch exception.
I can implement what I want by using the valueChangeListerner and converting the values in the event handling method, but I would like to, if possible, not have to write any code in the backing bean.
Can you give me an example of how I can do what I described above or recommend a good learning source?
Thanks.

I created an own Checkbox Renderer which extends com.sun.faces.renderkit.html_basic.CheckboxRenderer and overwrite the method getConvertedValue.
    public Object getConvertedValue(FacesContext context, UIComponent component, Object submittedValue)
              throws ConverterException
        Converter converter = ((ValueHolder) component).getConverter();
        return converter.getAsObject(context, component, (String)submittedValue);
    }

Similar Messages

  • Default Value in Numeric Input Field in Visual Composer Application

    Hi All,
    I have developed a visual composer application which has a numeric input field for Hours.
    It is mapped to a backend module.
    We are using portal 7.31
    The problem is that the deafult value of this input field is "0", but the rquirement is to display as "0.0"
    The functionality has been tested with input values in decimals and works fine. The problem is when the screen first populates, that field should show "0.0" .
    Please advise.
    Thanks

    Hi Soumya Chanda,
    I don't know of an agreeable way around it. You could have a textual input, but then it doesn't have the numeric control behavior, plus you need to handle incorrect typing (alphanumeric notes).
    Sorry!

  • Vague error message when using wildcards in a numeric search field

    Dear forum readers,
    When a user submits a search string containing a wildcard (e.g. 64%) in a numeric search field of a JHeadstart generated search section, the application returns with an error message like "For input string: %2".
    I'd like to show a more user-friendly message e.g. "Wildcard characters are not allowed in search field blablabla".
    Any suggestions on how this can be achieved would be most welcome.
    Regards,
    Ibrahim

    Well, I believe JHeadstart does not really have this functionality.
    One way is use a Query Operator 'startsWith', but then you always query like LIKE '<entered search value>%'
    This is probably not what you want...
    But you could hack it into advancedSearch in YourApplicationModuleImpl
    try {
    if (viewCriterium.getQueryValue() != null) { //This is where exception JHS-00116 is raised...
    value = viewCriterium.getQueryValue().toString();
    } else {
    value = null;
    catch (NumberFormatException ex) {
    //insert check for wildcard
    value = viewCriterium.getValue().toString();
    if (value.indexOf('%')>=0) {          
    sLog.debug("Ja, een wildcard!!!");
    operator = "LIKE";
    } else {//original exceptionhandling code here...
    ...and a bit later, add test for "LIKE":
    if (viewCriterium.isDate() || viewCriterium.isString() || "LIKE".equals(operator)) {
    value = "'" + value + "'";
    very nasty code, and does not raise an exception for searches like '%xxx'
    Good luck,
    HJH
    Edited by: HJHorst on Mar 5, 2009 12:03 AM

  • Numeric, date field data to be in English format

    My Characterset on 10g AS & 10gdb, NLS_LANG=ARABIC_KUWAIT.AR8MSWIN1256
    In my all arabic screen numerical number & date fields are in arabic. Instead all numeric & date fields should be in English. I have tried settting NLS_LANG=AMERICAN_AMERICA.AR8MSWIN1256 on Application Server. But no use & also by doing this just runtime application is doing flip,,ie from left to right.
    i know I can query using below
    TO_CHAR(hiredate, 'DD/MON/YYYY', 'nls_date_language = ENGLISH')
    Is there any way of doing that at database level, so that all fields of applicaton of type numeric & date are in english.
    thanks

    In reports I am getting Numeric & date format in English. But only forms all these are in arabic.

  • XLS upload via HSODBC. Unable to upload numeric (float) fields

    hi,
    I wrote a program unit with Oracle Forms Builder 10g to upload and read an Excel sheet.
    I created a HSODBC Data link to my DB, and used Excel 2003 to edit the XLS file to upload, and WEBUTIL_FILE_TRANSFER.CLIENT_TO_AS(client_dir_file,'\\server\dir\myfile.xls') to upload.
    My DBLink works and Im able to upload the file. But it seems oracle is unable to upload some fields containing numeric (float) values.
    running DESCRIBE Sheet1$@hsodbc; I got this table structure
    UPLOAD_DATE          DATE
    NUMBER VARCHAR2(32512 CHAR)
    CODE VARCHAR2(32512 CHAR)
    DESCR          VARCHAR2(32512 CHAR)
    SIMILARS FLOAT(49)
    WIDTH VARCHAR2(32512 CHAR)
    HEIGHT VARCHAR2(32512 CHAR)
    HIGH      VARCHAR2(32512 CHAR)
    ITEMS      FLOAT(49)
    fields SIMILARS, WIDTH, HEIGHT, HIGH, ITEMS contain numeric values in float format (ex: 1,00000). When I run
    SELECT * FROM SHEET1$@HSODBC
    I get that WIDTH, HEIGHT, HIGH columns are EMPTY (contain NULL values), while SIMILARS and ITEMS contains not null values.
    I am sure that the \\server\dir\myfile.xls contains not null values for WIDTH, HEIGHT, HIGH fields! I tried to change cells format before upload, setting them to FLOAT, but I got no results!
    Please help me, how can I do to change cell format in order to obtain a correct upload?

    E.C.
    there is a mistake in the subject. As I said in my thread, the upload works and the uploaded file contains all values. My problem is that I am "unable to READ" the numeric values stored in VARCHAR2 fields.

  • Problem with numeric screen field....

    hi,
       I've gotta situation that,
    In sales order we gotto determine WBS element(ps_psp_pnr) based on some conditions, if none of the condition is satisfied then the 'project definition'(prps-pspid) has to be concatenated with '.99' and displayed as WBS element.
    Now the actual problem is, WBS element is of numeric character type whereas the projectdefinition(pspid)+.99 is of charcter type. So it throws me a dump. Even then, the screen field of WBS element doesnt shows any non numeric character and shows error message.
    So how do i overcome this situation? Can anyone help me? Its quiet urgent.
    Prompt answeres will be rewarded with points.
    with regards,
    praveen.

    Hi Praveen,
    If you take SE16 and PRPS, you can see how SAP store it internally and show externally. In the first screen where it shows the line items, the WBS element value is the one stored internally and if you double click and see the WBS value in the next screen it is the one showed in the transaction screen.
    For the conversion routine, even if the parameters are type less, you have to pass the variable with type.
    For example
    data: w_POSNR type PS_POSNR,
          w_wbs(8).
    w_wbs = '123.55'.
    CALL FUNCTION 'CONVERSION_EXIT_ABPSP_INPUT'
      EXPORTING
        input          = w_wbs
    IMPORTING
       OUTPUT          = w_posnr
    EXCEPTIONS
       NOT_FOUND       = 1
       OTHERS          = 2.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • Dynamically change the pattern of numeric/decimal field in adobe

    Hi, I have a ADOBE form created through SAP.
    One of the field in the form is a numeric type and its property under Object>Cell>Display pattern is set as z,zzz,zzz,zz9.99.
    I have a requirement that for a particular condition this field should display the values with four decimal places. I am not able to figure out what property to use in the scripting.
    I tried fracDigits and Format. It does not work.
    The decimal places always remains 2 as set in the display pattern.
    Is there any way to change this display pattern dynamically based on a condition?
    any help would be greatly appreciated.

    I found the answer from other discussions in this forum. sorry to have overlooked it earlier.
    The answer to my pbm is to use the Format.picture = "zz,zzz,zz9.9999"

  • Display pattern not working - add $ for a numeric/decimal field

    I've designed a form which has fields where I need to display currency(US) values.
    I've made the fields as numeric type. I've added the display pattern as num.currency{} and also tried with num{($z,zzz,zzz9.99)}. But nothing seems to be working.
    The amount value passed in the xml input is 7,002.978.
    The result that I'm getting now is $0.00
    When I changed the field to decimal type and added the same display pattern as above, the result that I get is BLANK:  $
    I need to format it such a way that it displays $7,002.99 in the form. There's no limit for the leading digits and the digits after decimal point should be 2. Is there a way to get this by changing the "PATTERNS" properties?
    Please let me know how I can get the pattern right.
    I'm using LC Designer ES2.

    Hi,
    By default it is not going to like the comma in your xml input, so you will need to change the data pattern.  Try using num{z,zz9.999}, which works for your example value.  With the comma it will treat the value as text and just display what it gets.
    If your display pattern is num.currency{} then you will get two decimal places, but that makes the value $7.002,98.  I'm not sure how you get $7.002,99 ... is that just a type-o?
    Regards
    Bruce

  • Numeric Input field - contains zeroes after initializing

    Hello,
    I have a input field for R/3 reservation number which is numeric. When the view is first displayed the input field is blank. If If leave this view and return I am clearing the field using the following
    <b>wdContext.currentBapi_Reservation_Getdetail_InputElement().setReservation(null);</b>
    The field is cleared as expected but is now filled with Zeros.  How can I clear this field but avoid having it filled with zeros. Need to have the field empty as it the first time it is displayed.
    Regards,
    Keith L.

    Hi Baskaran,
    I tried setting to "" instead of null and get the same results. What is strange is that If I try to set to "ABC" or any other character string it dumps with the following error.
    If I try and set to numberic value "123" it is ok but once again it includes leading zeros.
    Error stacktrace:
    com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field RESERVATION, complex type class XYZ.com.gm8.Bapi_Reservation_Getdetail_Input
    <b>wdContext.currentBapi_Reservation_Getdetail_InputElement().setReservation("ABC");
    wdContext.currentBapi_Reservation_Getdetail_InputElement().setReservation("123");</b>
    Any ideas on where the enforcement of numneric is at? From what I see in the data dictionary entries created by Adaptive RFC it is defined as a string
    Rgds,
    Keith

  • Inputting commas in a numerical form field

    I downloaded NY State Tax Form IT-203. The numeric fields accept numbers but not commas. How do I enter commas? I am using the latest version of Adobe Acrobat Pro. Thanks.

    You better use it the way it is. It's possible it will auto-format, and if
    it doesn't that's probably how they want it to be.
    If you start editing the file you're risking it being discarded, and in
    some places it can even be considered an offense to mess around with
    governmental documents.

  • How to ignorenon-numeric parameter field value

    Post Author: burhan.survery
    CA Forum: General
    I am passing a parameter to a subreport. While running the report, I get an error which says that the parameter field is a non-numeric value. I'm not sure why since, the parameter field should be passing a quantity. Is there a way for me to check if the parameter field is passing a non-numeric value and if so, ignore it so  that the report continues.
    thanks.
    b

    Post Author: bettername
    CA Forum: General
    Strange! I would have imagined from the fact that it gave you the original "non-numeric" error that it must be passing a string (how can a number be non-numeric!), but that's clearly not the case.  I'm stumped...  What does Crystal identify the 'source' field as (do a 'browse data' or 'show field types')? I assume that the parameter datatype is the same as the source field? 
    What's your data source (SQL Server, DB2 etc...)?  Is there a way you can validate everything is numeric outside of Crystal?

  • Sign in front of numeric/currency field in ALV grid/list

    Dear all,
    We need to display sign in front for numeric/currency values which will
    use the sub-total functionality. Currently there is no option for doing
    this in ALV output options.
    Is this possible?
    regards
    Nitesh

    Hi,
    Please go throw below links ,
    may be it will solve u r problem
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    Regards
    Suresh.d

  • How do I allow a single symbol in numeric-only field?

    Good morning all,
    I could use a little help with this one. I am using Acrobat 10 today working with form-fields in a document.
    Currently I have several fields where I have limited input to numbers only (max three digits) using the folowing script:
    function triDigKS
    {    // Get all that is currently in the field
        var val = AFMergeChange(event);
        // Reject entry if anythig but digits
        event.rc = AFExactMatch(/\d{0,3}/, val);
    They have thrown me a curve on this one. They want to be able to dispay negative numbers by using the minus (or dash/hyphen) symbol as well.
    so before the field would display any 3-digit number but nothing else. No dashes, dots or anything else. I am limited by the fact that they only want to allow this single symbol and no other as well as up to a three digit number like so (-300, -27, -1 etc).
    Any help out there?
    Steve

    Actually, I figured it out…I was removing too much from the code you gave me originally. To clarify, I did need to get to where the field would accept a or nothing…but I think I have it sussed.
    Thanks!
    Steve
    The Promontory Help-Desk
    Promontory Interfinancial Network, LLC
    1515 North Courthouse Road, Suite 1200
    Arlington, VA  22201-2909
    866.776.6426, ext. 3450 (Telephone)
    703.292.3451 (Fax)
    [email protected] <mailto:[email protected]

  • Format of a numeric/decimal field

    Can we set the format of a decimal field to display zzz.999 without rounding off the value. For example,I have a decimal field with display & Edit pattern set as "zzz.999" and trailing digits limited to 3. If I enter a value 123.456, its ok. But if I put 123.4567 the value is rounded off and displayed as 123.457. Can we limit it somehow to truncate anything extra than 3 trailing digits.
    Thanks
    Shweta

    Maybe not automatically, but you should be able to do this with a little JavaScript in the form.
    Mike

  • GUI_DOWNLOAD ignores blank in a numeric character field

    Hi, exparts.
    I found a problem about function module GUI_DOWNLOAD.
    With the file type 'ASC', blanks in type N - fields disapears.
    Field1(type N) = '  1 '
    Field2(type N) = '  2 '
    Download these 2 fields, then data become '12'
    I hope '  1   2 '.
    I've already confimed the import parameter 'TRUNC_TRAILING_BLANKS_EOL' does not affect this problem.
    Please tell me how to avoid this problem!

    Hi, Sunil
    Thank you for your imformation.
    SAP also says thet all blanks are eliminated.
    In fact I could not be satisfied with it, and contacted OSS. Then I received this disappointing answer.
    So I changed type from N to C.
    Thank you a lot.
    Naomi S.

Maybe you are looking for