Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

programmatic partial submit

my form consists of following elements:

  1. icefaces text field to enter search criteria.
  2. icefaces command button (find) to make partial submit and populate a div with new list of matched users.
  3. other two icefaces text fields, when submitting whole form i need their values.

Requirement: i want when user press enter in the text input field, that find button gets clicked (when the button gets clicked by mouse it makes partial submit automatically)

so here's what i tried:

<ice:inputText id="recipient" value="#{myBean.searchValue}" size="60" 
                     onkeydown="handleEnter(event,this.form);" >
                </ice:inputText>

                <ice:commandButton id="find" value="Find"  action="#{myBean.findEmployees}" partialSubmit="true"
                     >
                    <f:ajax execute="@this" render="employees" />
                </ice:commandButton> 

ISSUE: what happens is the when user press enter, find button is invoked, but whole form gets submitted, so a required validation error appears for the other two text fields.

please advise why whole form is getting submitted, and how to handle such issue.

Upvotes: 0

Views: 2332

Answers (2)

Paul
Paul

Reputation: 1

set immediate = true on the button

Upvotes: -1

Mahmoud Saleh
Mahmoud Saleh

Reputation: 33605

to get the enter button working fine with partial submit, i have to remove the 'required=true' tag from the inputs and make the validation with JS.

Upvotes: 0

Related Questions