Ids of forms fields

1
0
-1

Hi I am using Bonita CE 6.3.4. I have a check box and a select box. I want to enabled the select box when the check box is checked and disabled if it is not checked.

I saw in a previous post that I need to put in the section options/HTML attributes of the check box, something like that:

onchange="if (document.getElementById('checkbox_Id').getElementsByTagName('input')[0].checked) { document.getElementById('selectbox_id').getElementsByTagName('input')[0].removeAttribute('disabled'); } else { document.getElementById('text').getElementsByTagName('input')[0].disabled='disabled'; }"

My question is how can I obtain the id of the check box and the select box?

If I put this on the HTML attributes of the check box:

onchange="alert (this.id);"

It returns "undefined":

In the inner HTML of the form i can't see the fields.

Thanks in advance

1 answer

1
0
-1

It was solved. It is possible define the id in HTML attributes

In HTML attributes of the check box:

id="pepe" onclick=onchange="if (document.getElementById('pepe').checked){ document.getElementById('coco').firstChild.disabled=false;} else{ document.getElementById('coco').firstChild.disabled=true;}"

In the section HTML attributes of the selectbox:

id="coco"

with the readOnly property checked.

Bonita put the form fields into div elements. In the case of the check box, bonita assigned the id to the check box element, but in the case of the select box bonita assigned the id to the div. I used the firstChild method by this reason.

Comments

Submitted by ttoine on Thu, 10/09/2014 - 16:51

FYI: select a widget, then "General/Options", and here you will find the "HTML Attributes" field for the selected widget. Please note that you can also set class and style directly in "Appearance/Field" and "Appaarence/Label".

Notifications