So, the page has an action which must be invoked when "enter" is pressed.
VISUALFORCE:
//script: function pressReturn(e, currOffer) { var keyPressed = e.keyCode; if (keyPressed == 13) { insertOffer(currOffer); } } //Action Function: <apex:actionFunction name="insertOffer" action="{!setNewBidOffer}"> <apex:param name="currOffer" value="currOffer" assignTo="{!currentOffer}"/> </apex:actionFunction> //input fiel: <apex:inputText value="{!currentOffer}" onkeypress="return pressReturn(event, j$(this).val());"/>
The action invoked by the controller (setNewBidOffer) does stuff and then returns a PageReference null.
In chrome everything works fine: the user writes, presses enter, the javascript is called, setNewBidOffer is done, null is returned and the page is refreshed.
This is not happening in mozilla and in IE. I tried to set some debug logs in the action setNewBidOffer and apparently, when I use mozilla or IE, the action in the controller is not even called.
What am I missing? thank you very much for your patience and attention!
Best Answer
Try to use jQuery to trigger on the keyPress/keyDown events. Additionally i leave the
value
parameter empty if i want to set it from another javascript function and usereRender
to refresh some areas:But one thing i don't understand: you trying to set the
currentOffer
variable to thecurrentOffer
variable?