Board index JavaServer Faces General Javascript (client evaluated) parameter functionality

Javascript (client evaluated) parameter functionality

Components, Ajax Framework, Utilities and More.

Posts: 3
I have the following problem, I need to
1)make an ajax call to the server from javascript,
2)pass some dynamic javascript parameters and
3)execute an action method,

Using remoteCommand, the only option I found is:

<p:remoteCommand name="remoteCommandName" id="remoteCommandID" action="someAction" />

And call somewhere in the page to:

PrimeFaces.ajax.AjaxRequest(url, {source:'remoteCommandID',...}, {'paramname1':javascript_value_param,...});

Since calling the rendered function (remoteCommandName()) does not send the parameter I want.

Using f:param does not result in what I need, since the parameter is computed statically.

Is weird or against the design to ask for something like:

<p:remoteCommand name="remoteCommandName" id="remoteCommandID" action="someAction" >
  <p:param name="someName" type="client" />

where p:param is a new component, and its attribute type="client" indicates that the parameter should be rendered specially (to be evaluated on the client), something like:

<script type="text/javascript">
function remoteCommandName(arg1){
PrimeFaces.ajax.AjaxRequest(url, {source:'remotepepe', ...'},{'someName':arg1});

I know this means changind org.primefaces.renderkit.CoreRenderer.buildAjaxRequest (...) to consider different classes of parameters.

Thanks in advance, the components are really good and easy to use.

Return to General