0

how to pass jquery variable from visual force component to apex controller?

The requirement is ,need to validate by checking the storage available in salesforce while uploading files ,

if the files are exceeded the limit need to show feedback message

here the script is in visualforce component

we used dropzone for file uploading

sfdcfox
  • 489,769
  • 21
  • 458
  • 806
raja
  • 1

1 Answers1

0

If your controller is using a @RemoteAction method, you can directly pass whatever params you want when calling that method.
If not, you can declare an apex:actionFunction with nested apex:param tag, which will become aliased as a JS function that you can simply call from your jQuery code. example:

<apex:actionFunction name="myValidator" action="{!yourControllerValidatorMethod}" rerender="">
    <apex:param name="param1" value="" assignTo="{!someControllerProperty}" />
</apex:actionFunction>

then in your javascript, you can easily call it like this: myValidator(yourJqueryVariable);

RenegadeCoder
  • 2,557
  • 15
  • 27