Select box element id in DOM

Confluence User - 16 Oct, 2020

Hi,

I have a select box in a form and I want to write some custom javascript to make another text field mandatory and/or readonly depending on the value selected by the user.

When I look at the code generated by Joget I see this


<label class="label" for="field114245" field-tooltip="field1">Employee Type <span class="form-cell-validator">*</span></label>
<select id="field114245" name="field1" >
<option value="0" grouping="" ></option>
<option value="1" grouping="" >Regular</option>
<option value="2" grouping="" >Manager</option>
<option value="3" grouping="" >Director</option>
</select>
</div>


The field id of the select box is "field1" in the form


Why is the id in the generated html  "field114245"?

Worse is that the value keeps changing every time I do a page refresh


selectbox;id;javascript

4


16 Oct, 2020
confluenceUser
1
confluenceUser

Hi there,

There is a Javascript API provided by Joget that you can use to get the object or value from form fields:

Javascript API#getField(fieldId)

Javascript API#getValue(fieldId)

So for your case, the code will look like:

FormUtil.getField("field1");
16 Oct, 2020
confluenceUser
confluenceUser

Is that a bug?

16 Oct, 2020
confluenceUser
confluenceUser

I think this is a security feature to prevent bot spamming form submission.

17 Oct, 2020
confluenceUser
confluenceUser

Weird! It looks to be happening only on select box controls.

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print