cancel
Showing results for 
Search instead for 
Did you mean: 

no update data with javascript function in HTMLB template

Former Member
0 Kudos

Hello

I have a problem with updating data in the SAPLBBP_PDH_CUF 100 template, in creating or modifying shopping card item.

Well, I have 2 customers fields : ZZBUDGET (which is a checkbox) and ZZAMOUNT (which is an input text field). I'va implemented a javascript function to make disabled the ZZAMOUNT field when we uncheck the

ZZBUDGET checkbox.

Here is the code concerned:

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].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';

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

}

}

[...]

<input type="checkbox" name="GT_DISPLAY_100-VALUE[`j`]"

onClick="activer(`j`)" value="X" checked>

<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">

[...]

The problem is when i uncheck the ZZBUDGET checkbox (at this moment the ZZAMOUNT field is disabled and the value is 0,00), after refresh the data is not updated and the old ZZBUDGET and ZZAMOUNT values appears.

But when the ZZBUDGET is checked and when i change the ZZAMOUNT field, the data is correctly updated.

The problem is about the disabled javascript instruction. In fact, when i delete the line "document.BBPForm.elements[montant].disabled =

true;", it works. But i want to make the field disabled or not disabled.

Thank you for your help.

Peggy.

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 = ' ';

}

}