0

I would like to execute a JSF managed bean function within JavaScript If-condition. What I have realized is that the function though inside a JavaScript if statement gets executed as the page loads.

Example:

function checkFileName(element){ 
        if(name != ""){     
             // I want to be able to execute this function inside this JavaScript to remove errors on the server side when name != ""
             #{interfaceImplantsBean.removeErrors()}; 
         }              
}

Important Update

There is a form with fileupload input field. When a user selects the wrong file, an error is shown. This is the errors I want them deleted when the user clicks on another button "move". The "errors" is an arraylist field on the managed bean.

The problem I have with using hidden button is that I don't want the file in the form to be sent to the server again because "commandButton" and "commandLink" functions as submit button. I only want the errors in the managedbean to be deleted. The content of the fileupload input field should remain. (I could have saved the content of fileupload field and assign it later if am to use commandButton or commandLink but it is not possible for security reasons)

Is there a way to talk to the managedbean (calling functions) without using "commandButton" and "commandLink". This will definitely solve my problem. How do I do it?

halfer
  • 19,824
  • 17
  • 99
  • 186
Eddy Freeman
  • 3,207
  • 6
  • 35
  • 55

0 Answers0