Javascript with placeholders on button element

jo-ka

Member
Hello.

I have a button element on a form, which I want to link to another page via Javacript.

So, I have a calc element which will get the link from another table, like this:

PHP:
$db = JFactory::getDBO();
$sql="SELECT fab_acoes_formacao.teste_regras FROM fab_acoes_formacao";
$sql.=" WHERE fab_acoes_formacao.id = ";
$sql.="'{fab_resultados_acoesformacao___acao_raw}'";
$db->setQuery($sql);
return $db->loadResult();

This will return a link:

HTML:
http://xxxxxxx.com/index.php/...

Then, on that button element, I want to, when on click on that button, jump to the calculated link.

I've tried with this:
upload_2019-10-15_9-35-9.png


But the result is this,

upload_2019-10-15_9-34-46.png

It doesn't read the placeholder.

Is there a way to achieve this?

Thanks in advance.
 
I don't think you will get element substitution in javascript like that. I think you will need to get the value of the element in javascript and then pass it to the window.open call.
 
OK,
Following your suggestion, I've ended up doing like this:

window.open (document.getElementById('fab_resultados_acoesformacao___link_calc_regras_ro').innerHTML);
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top