2 Replies Latest reply on May 12, 2009 10:36 PM by pedalshoe

    preserving leading drop downs

      I have working code! but I can't preserve the leading zeros; my table entries are:

      accountTypeCode  accountTypeDesc
      01               Business Checking
      02              Personal Checking
      03              Personal Savings

      my xhtml:

                              <h:selectOneMenu id="bankaccounttypes" value="#{accountProfile.bankAccountType}">
                                  <s:selectItems var="t" label="#{t.accountTypeDesc}"  noSelectionLabel="-- Select --"
                                                 value="#{bankAccountTypes.resultList}" />

      Where bankAccountTypes is defined in components.xml:

      <framework:entity-query name="bankAccountTypes"
            ejbql="select bat from BankAccountTypes bat">

      When renendered, the dropdown is created as planned, but the values for each option is "0", "1", "2".  Instead of "00", "01", "02":
      <select id="bankaccounttypes" size="1" name="bankaccounttypes">
      <option value="org.jboss.seam.ui.NoSelectionConverter.noSelectionValue">-- Select --</option>
      <option value="0">Business Checking</option>
      <option value="1">Personal Checking</option>
      <option value="2">Personal Savings</option>

      Thank you,
        • 1. Re: preserving leading drop downs

          That is not what is happening. This is just the way the entity converter works, the first entity is entity 0, the second 1 etc, it has nothing to do with leading zeros. The target accountProfile.bankAccountType should be a BankAccountTypes and not a string anyway.

          Does the code actually work?

          • 2. Re: preserving leading drop downs

            Then it was a coincidence.  When I saw the html rendered and saw the value populated, I just assumed it was correct, and I just had to understand it.  It makes sense to make accountProfile.bankAccountType a BankAccountTypes type...  I will try it now.
            Thanks for the response.