Forums

Home » Alloy UI » English

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Beatrice Haidegger
aui:input problem with scriptlet
September 26, 2012 12:29 AM
Answer

Beatrice Haidegger

Rank: New Member

Posts: 13

Join Date: September 26, 2012

Recent Posts

Hello,
I have a problem when I use scriptlet to set the readonly attribute to an aui:input control.
I want to set readonly attribute only if I read that from an object "struttura". If I set it in a input like this:

<input value="TEST" <%= struttura.getREGIONE().getREADONLY() ? "readonly=\"readony\"" : "" %> />

or this

<input value="TEST" ${struttura.REGIONE.READONLY ? "readonly=\"readonly\"" : "" } />

all is ok and it's work properly, but if i use the scriptlet in a aui:input:

<aui:input label="DESCRIZIONE"
name="descr_regione" type="text" id="descr_regione"
value="<%=nomeRegione %>" maxlength="${struttura.REGIONE.LENGTH}"
readonly="${struttura.REGIONE.READONLY}"
<%= struttura.getREGIONE().getREADONLY() ? "readonly=\"readony\"" : "" %>
/>
I have this error:
"Unterminated &lt;aui:input tag"

How can I do it?

Beatrice
Zac Thomas
RE: aui:input problem with scriptlet
September 26, 2012 1:38 AM
Answer

Zac Thomas

Rank: New Member

Posts: 1

Join Date: September 8, 2012

Recent Posts

Hello!
Suresh Kumar
RE: aui:input problem with scriptlet
September 26, 2012 1:47 AM
Answer

Suresh Kumar

Rank: Junior Member

Posts: 41

Join Date: May 9, 2012

Recent Posts

Hi,

I am also facing the same issue. Please could someone help on this.

I am using following line.....
<aui:input name="nooflicenses<%=i%>" value=""/>

Its not working

Thanks,
Suresh
Amos Fong
RE: aui:input problem with scriptlet
September 26, 2012 10:02 PM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1912

Join Date: October 7, 2008

Recent Posts

@Beatrice,
You can't put inline values in a tag library. You can only use attributes defined in the aui.tld.

Also readonly isn't one of those attributes. You could probably use "disabled" instead.

@Suresh,

You can't mix strings with a scriptlet in a tag library attribute. The entire value has to either be a string, or a single scriptlet. Here's what it should be in your example:
<aui:input name="<%= "nooflicenses" + i %>" value=""/>
Beatrice Haidegger
RE: aui:input problem with scriptlet
September 27, 2012 12:00 AM
Answer

Beatrice Haidegger

Rank: New Member

Posts: 13

Join Date: September 26, 2012

Recent Posts

Thanks Amos for your answer.
I used disabled attribute and in this way it works emoticon
Suresh Kumar
RE: aui:input problem with scriptlet
September 27, 2012 12:20 AM
Answer

Suresh Kumar

Rank: Junior Member

Posts: 41

Join Date: May 9, 2012

Recent Posts

Amos Fong:
@Beatrice,
You can't put inline values in a tag library. You can only use attributes defined in the aui.tld.

Also readonly isn't one of those attributes. You could probably use "disabled" instead.

@Suresh,

You can't mix strings with a scriptlet in a tag library attribute. The entire value has to either be a string, or a single scriptlet. Here's what it should be in your example:
<aui:input name="<%= "nooflicenses" + i %>" value=""/>



Hi Amos,

Thank you very much for the reply.

My JSP line..............<aui:input name="<%= "nooflicenses" + i%>" id="<%= "nooflicenses" + i%>" value=""/>

Whenever I am using the above the following error is thrown. Please assist.

07:10:10,025 ERROR [http-bio-8080-exec-239][PortletRequestDispatcherImpl:108] org.apache.jasper.JasperException: /html/display/orderNow.jsp (line: 193, column: 110) Attribute value "nooflicenses" + i is quoted with " which must be escaped when used within the value
org.apache.jasper.JasperException: /html/display/orderNow.jsp (line: 193, column: 110) Attribute value "nooflicenses" + i is quoted with " which must be escaped when used within the value
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)


--Suresh
Beatrice Haidegger
RE: aui:input problem with scriptlet
September 27, 2012 12:23 AM
Answer

Beatrice Haidegger

Rank: New Member

Posts: 13

Join Date: September 26, 2012

Recent Posts

Try this:

1<aui:input name="<%= \"nooflicenses\" + i%>" id="<%= \"nooflicenses\" + i%>" value=""/>
Suresh Kumar
RE: aui:input problem with scriptlet
September 27, 2012 12:37 AM
Answer

Suresh Kumar

Rank: Junior Member

Posts: 41

Join Date: May 9, 2012

Recent Posts

Beatrice Haidegger:
Try this:

1<aui:input name="<%= \"nooflicenses\" + i%>" id="<%= \"nooflicenses\" + i%>" value=""/>



Hi Beatrice Haidegger,

Its working now. Thanks you so much to Amos and Beatrice Haidegger.

--Suresh
Suresh Kumar
RE: aui:input problem with scriptlet
September 27, 2012 10:58 PM
Answer

Suresh Kumar

Rank: Junior Member

Posts: 41

Join Date: May 9, 2012

Recent Posts

Suresh Kumar:
Beatrice Haidegger:
Try this:

1<aui:input name="<%= \"nooflicenses\" + i%>" id="<%= \"nooflicenses\" + i%>" value=""/>



Hi Beatrice Haidegger,

Its working now. Thanks you so much to Amos and Beatrice Haidegger.

--Suresh


Hi Amos and Beatrice Haidegger,

Please assisst, how to use above in select options in a loop ???? below is not working


for(Tariff f : tariff)
{
%>
<aui:option value="<%= "f.getOption()" +i %>"> <%= "f.getOption()" +i %></aui:option>
<%
}

Thanks,
Suresh
Amos Fong
RE: aui:input problem with scriptlet
September 30, 2012 8:34 PM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1912

Join Date: October 7, 2008

Recent Posts

Hi Suresh,

In your scriptlet you're making f.getOption() a literal string so it's not the actual value.