form.js and placeholder

arie

Member
Hello,

I was wondering whether we can inlude Fabrik's placeholder using '{}' into the form.js files?
If yes, how?

Thanks,
 
What do you mean by form.js files? You mean the ./component/com_fabrik/js/form_X.js custom JS files?

If so, no. All we do it include those on the page.

If you need to get the value of an element in JS, in 3.0, the best way is typically:

form_X.formElements.get('yourtable___yourelement').getValue();

That calls the getValue() method for the Fabrik element's JS class, which "knows" how to extract the value in a usable format. So, for instance, on a date element, it'll return it as a simple MySQL formatted string, even though the DOM structure has it split in to several separate DOM elements. Or a database join element will return the value (rather than the label), etc.

-- hugh
 
You could use a PHP form plugin, running onload, which uses FabrikHelper::script() to add your JS something like this ...

Code:
$myJS = "Fabrik.myString = '" . JText_('your string to translate') . "';";
FabrikHelperHTML::script($myJS);

If you search in the Fabrik source code for instances of that script() call, you'll get some hints on how we add stuff to the page's JS.

You should then be able to access Fabrik.myString in your form JS code.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top