RudiDudi
RudiDudi

Reputation: 455

disable an input type in base of his value

i got this code :

<%
    for (int i = 0; i < nr_atte_old; i++) {
%>
        <TD class="tb" align=center>
            <INPUT class="txt_opz" type="text" style="width:40;" id="hDett_Sin4<%= i %>" name="hDett_Sin4<%= i %>" maxlength='2' value="<%=DataResultForm.getValueHTMLEncode( "hDett_old_risp_"+i )%>">
        </TD>
<%
    }
%>

the value is returnet from a stored procedure, how can i disable dinamically this input type if, for example his value is "hello"

HTML+CSS way is preferred, if possible (not using javascript)

Upvotes: 1

Views: 66

Answers (1)

vp_arth
vp_arth

Reputation: 14992

Just use java condition:

<% String val = DataResultForm.getValueHTMLEncode( "hDett_old_risp_"+i );%>
<input value="<%=val%>" <%= val=='hello'?'disabled':'' %> />

Upvotes: 2

Related Questions