cancel
Showing results for 
Search instead for 
Did you mean: 

problem with javascript function and HTMLB

Former Member
0 Kudos

Hello I have problem with refresh of data afeer implementing a javascript function in the template SAPLBBP_PDH_CUF_100.

Here the source code :

function activer(i)

{

var j = i + 1;

var coche = 'GT_DISPLAY_100-VALUE['i']';

var montant = 'GT_DISPLAY_100-VALUE['j']';

if(document.BBPForm.elements[coche].checked == true)

{

document.BBPForm.elements[montant].disabled = false;

document.BBPForm.elements[coche].value = "X";

}

if(document.BBPForm.elements[coche].checked == false)

{

document.BBPForm.elements[montant].disabled = true;

document.BBPForm.elements[montant].value = '0,00';

}

}

<input type="checkbox" name="GT_DISPLAY_100-VALUE[`j`]" onClick="activer(`j`)" value="X" checked>&nbsp;&nbsp;

<input type="text" id="GT_DISPLAY_100-TEXT[`j1`]" name="GT_DISPLAY_100-VALUE[`j1`]" value="`GT_DISPLAY_100-VALUE[j+1]`" maxlength="013" size="013">

I would like to active or desactivate an input text field when click or unclick a checkbox.

The problem is that when i click the checkbox and fill the input text, the data is correcly updated, but when i want to unclick the checkbox, the data is not updated, end always show the last value and the checkbox is always checked.

It works in the SAPGUI but it doesn't work in the template..

thank for your help.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

It is ok now.

I replaced the disbled fonction to readOnly javascript fonction. Don't know the reason but it works now.

Like that:

function activer(i)

{

var j = i + 1;

var coche = 'GT_DISPLAY_100-VALUE['i']';

var montant = 'GT_DISPLAY_100-VALUE['j']';

if(document.BBPForm.elements[coche].checked)

{

document.BBPForm.elements[montant].readOnly = false;

document.BBPForm.elements[coche].value = 'X';

}

if(document.BBPForm.elements[coche].checked == false)

{

document.BBPForm.elements[montant].readOnly= true;

document.BBPForm.elements[montant].value = '0,00';

document.BBPForm.elements[coche].value = ' ';

}

}