0

My objective is to save the current cursor position and append new values to it for every new button we enter.To achive it i am trying to send a ajax request and update my back end coordinated every time is focus out of the input field. I am succesfull i calling the java script function before calling by backing bean action method.But for some reason i am unable to see my request param values when ever i make a ajax request.

<p:inputText id="testing1" value="#{dropDownView.city}">
 <p:ajax event="keyup"  onstart="callOnAjax();"  listener="#{dropDownView.assignCity()}"  execute="@this"  update="out1" >
  <f:param value="test" name="#{articlePromo.promocionArticuloId}"/> 
   <h:inputHidden id="x" value="#{bean.x}" />
   </p:ajax>

<script type="text/javascript">
  function callOnAjax(){
$("#detailsPanel").bind("keydown keypress mousemove", function() {
  var $form = jQuery(this).closest("form");
$form.find("input[id$=':x']").val($(this).caret().start);
  alert("Current position: " + $(this).caret().start);
});         
} 
</script>

And in my dropDownView Controller

public void assignCity()
{
    System.out.println("positon of x"+getX()+"position of y"+y);
    FacesContext context = FacesContext.getCurrentInstance();
    String id = context.getApplication().evaluateExpressionGet(context, "#{articlePromo.promocionArticuloId}", String.class);
    city =country;
}

I tried all different approaches using hidden as well.But i dont see the value in my controller.I even hard coded the request param value and hidden attribute value.But still not succesfull.Any help is much appreciated.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
jay
  • 1
  • Possible duplicate of [JQuery, How to pass parameters in get requests](http://stackoverflow.com/questions/15576548/jquery-how-to-pass-parameters-in-get-requests) – Perdomoff Nov 09 '15 at 20:54
  • @Perdomoff: I am trying to use jsf and primefaces tags to perform this.Thanks – jay Nov 09 '15 at 21:20
  • 1
    Possible duplicate of [How to return the response from an asynchronous call?](http://stackoverflow.com/questions/14220321/how-to-return-the-response-from-an-asynchronous-call) – Prune Nov 09 '15 at 21:54
  • Can any one please suggest me a technique using jsf tags – jay Nov 10 '15 at 12:16
  • Can any one please let me know if i missed any thing here or is it not the right way of doing this in primefaces 5.3 and Jsf 2.2.Thanks – jay Nov 12 '15 at 13:28
  • Adding additional irrelevant tags and keeping to ask for help does actually do result in the opposite. You push people off. – Kukeltje Nov 12 '15 at 13:56
  • And btw, `p:ajax`has no `execute` attribute. And please try to explain the functional requirement for which you think something like this is the solution – Kukeltje Nov 12 '15 at 14:09

0 Answers0