Forum


Calc Builder Support

Calc Builder support
Forums
Public write access is disabled. Please login

Get values out of Javascript 28.09.2017 07:03

Hi,
have managed to write values from Javascript into an html form, but can't manage to get them into the fields I had made (php).
I have this code to populate an html form and that is working:
function showCoords(c)
{
CB('#x1').val(c.x);
CB('#y1').val(c.y);
};

The x1 and y1 are the ID's of the form fields. The form is in the 'form layout'.

How can I get these values into the fields I have made so I can print them and send via email?

Hope you can help!

Thanks

Re: Get values out of Javascript 28.09.2017 18:09

Hi,
we suggest to use calcbuilder inputs, instead of creating them by hand at the form, so you will be able to recover them directly at the php section:

- Field configuration: var = myfield
- Input form ##myfield##
- Set one value using javascript: CB("input[fldname=myfield]").val(37);
- At the php code: $myfield

If you dont use calcbuilder fields, then you will have to recover your values using default php code for joomla:

$jinput = JFactory::getApplication()->input;
$value = $jinput->get('yourvarname');

Hope this helps
Moonsoft Team
www.moonsoft.es

Re: Get values out of Javascript 02.10.2017 06:43

Hi,
thanks a lot for your help, I had not seen your reply!
In the end I have managed to solve the problem.
I had put all my code in the Javascript part just before calculation. The solution was to add everything in the HTML part with its own buttons and now when clicking 'calculate' it can go to the next step and give the result.
I will also look at your solution, but right now it is working OK.

Re: Get values out of Javascript 02.10.2017 11:30

Ok, great it worked, thanks for sharing!

Regards
Moonsoft Team
www.moonsoft.es
Are you satisfied with our products/services/support?
Please help us to keep improving, add a review at  joomla extensions site and  magento connect
FaLang translation system by Faboba

Our clients' feedback