0

I have input text, and if enter key is pressed on this component following js for button programmatic click is executed:

document.getElementById('myform:saveNew').click();

The button jsf:

<h:commandButton value="test link" action="#{myBean.save()}" style="display:none;" id="saveNew">
                <f:ajax render="interests" execute="@this"></f:ajax>
</h:commandButton>

Currently if I click enter on the input text, the whole form is submitted and reloaded. I think that AJAX is not working in this case, while if I removed display:none; from the button (for testing) the AJAX and rendering is working fine.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498

1 Answers1

0

one workaround i found to hide the button and keep ajax working is to use the following class instead the style display none:

.hidden_button{
    height: 0px !important;
    width: 0px !important;
    padding: 0px !important;
    border: none !important;
}
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498