4 Replies Latest reply: Nov 15, 2012 3:23 PM by rolevine RSS

    hadcoding items for af:selectOneChoice do not work as expcted

    Raghava Ravindranath-Oracle
      I have a code something like below in JSFF page

      ------------------------------------------------------------------------------------------------------------------------------------------------------------------
      <af:panelFormLayout id="pflTransAttrs" maxColumns="1"
      labelWidth="30%" fieldWidth="70%"
      rendered="true">

      <af:inputText value="#{row.bindings.ValueText.inputValue}"
      simple="true"
      label="#{row.bindings.AttributeName}"
      required="true"
      columns="50" rows="1" wrap="hard"
      autoSubmit="true" id="itText"/>

      <af:selectOneChoice value="#{row.bindings.ValueText.inputValue}"
      required="true"
      id="socBoolean"
      label="#{row.bindings.AttributeName}"
      autoSubmit="true" simple="true">"/>
      <f:selectItem id="siTrueFalse1" itemLabel="#{bundle.EMPTY}" itemValue=""/>
      <f:selectItem id="siTrueFalse2" itemLabel="#{bundle.TRUE}" itemValue="Y"/>
      <f:selectItem id="siTrueFalse3" itemLabel="#{bundle.FALSE}" itemValue="N"/>
      </af:selectOneChoice>
      </af:panelFormLayout>
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------
      Note: "Save" button code is not shown above.

      When I click on Save button without entering value for both the fields (Text and SelectOneChoice), only Text box shows error message indicating "Error: a value is required, You must enter a value". After entering value to text field, clicking save again will cause selectOneChoice to prompt same error message.

      Issue: both components do not show error message at the same time(i.e. on 1st save click). I need to enter value for text first and click save again to see error message for SelectOneChoice field.

      Note: If i remove the item '<f:selectItem id="siTrueFalse1" itemLabel="#{bundle.EMPTY}" itemValue=""/>' form selectOneChoice . Both show the error message at the same time on 1st save button click, as expected. As I need empty value to be shown for selectOneChoice I cannot leave without it.

      Expected behavior: When save button is clicked without entering values for both(Text and SelectOneChoice) fields, error message should show for the both the fields at the same time.

      Please suggest how to overcome this problem.

      Thanks,
      Raghava