chetan
chetan

Reputation: 3255

Change JSP custome attribute value using javascript for JSP custome tag

I have developed JSP custom tag named <ctn:input mandatory = true> with one custom attribute named mandatory. Now i want to change mandatory value to false on click event of some other tag.
I am not able to change it using document.getElementById(id).mandatory = "false".
Is it possible ? how ?

Upvotes: 0

Views: 1921

Answers (3)

Pushpak U
Pushpak U

Reputation: 93

In this case you can't use javascript to change value...but you can use

<c:if > </c:if>

inside ur attribute value. for ex.

<ctn:input mandatory = "<c:if test='{yourCondition}'>true </c:if>">

or we can use choose here too...EX. this will select true if your condition is fulfilled of else it will set "false"

<ctn:input mandatory = "<c:choose><c:when test="${condition/variable}">true </c:when><c:otherwise>false</c:otherwise>">

Upvotes: 0

Udo Held
Udo Held

Reputation: 12548

With javascript you can only modify values in the rendered html. It won't effect your backend coding.

Upvotes: 0

Jigar Joshi
Jigar Joshi

Reputation: 240948

<ctn:input mandatory = true> is server side stuff and client will not recieve this as HTML dom so your java script won't play with it. You need to find out some other way for the same

Upvotes: 1

Related Questions