This topic is locked

javascript

5/25/2009 2:12:24 PM
PHPRunner General questions
G
garethp authorDevClub member

Hi
Whenever I add any javascript I add it manually using the visual editor. However on rebuild therefore this code disppears.
Is there any other way to add javascript on a more permanent basis, like with events or something so the code does not disppear on rebuild.
Many thanks
Gaeth

Sergey Kornilov admin 5/25/2009

Gareth,
you probably doing something wrong.
Contact support team directly sending your project and instructions on reproducing the issue.

G
garethp authorDevClub member 5/25/2009

Hi
I am not actually getting an errors. The problem I refer to only occurs if I have to reset a page where I have added any Javascript using the visual editor.
For example I add the following javascript on the add page inserted before the final </body></html> in the visual editor...
<script>
document.forms.editform.value_net_value.disabled=true;

var vv = document.editform.value_unit_price;

var ww = document.editform.value_quantity;

vv.onchange = vv.onkeyup =ww.onchange = ww.onkeyup =function() {

var qty = document.editform.value_quantity.value;

var unit = document.editform.value_unit_price.value;

document.editform.value_net_value.value =parseFloat(qty)*parseFloat(unit);}
</script>
This code works perfectly but...
What I would like to know is if there is anywhere I can add this code so that it does not disappear on rebuild. For example in an event or a php code snippet.
I drives be mad having to add these back in everytime. I have event resorted to ammending the template file so that on rebuild the javascript is automatically added in. Although this is a pain to have to manage.
Many thanks
Gareth

Sergey Kornilov admin 5/25/2009

Contact support team directly sending your project and instructions on reproducing the issue.