How can I pass "type" attribute within <html:text> in struts1 - jsp-tags

When I try to write something like this: <html:text styleId="Istituto" type="number"> in the struts1 it gives me an error
Attribute type invalid for tag text according to TLD
How can I add "type" attribute to <html:text> tag?

I know this is old, but I'm currently working on a super old application that uses Struts 1 framework, and today I had the same problem. Here's the solution I'm using that works:
<input type="number" name="budgetValue"
value="<bean:write name="applicantForm" property="budgetValue"/>">
Where:
budgetValue - is the Form property; applicantForm - is the Form

Thanks to Milebza for the answer, but for me only this way has worked.
<input type="number" name="budgetValue" value="${applicantForm.budgetValue}" />

Related

Chrome Autofill not filling correct input

Bit confusing and could not find any related issues online. As can be seen in the screenshot, when using the Chrome Autofill it is filling up the wrong input, even though the input have different ids.
This is using knockout template but not sure if its related.
HTML code for Billing Address
<input data-bind="value: $data.editor.SearchHouseNumber, uniqueId: $data.editor.SearchHouseNumber, valueUpdate: ['blur', 'afterkeydown', 'onload'], css: $data.editor.labelClass" maxlength="100" name="customerSearchHouseNumber" placeholder="House no." size="24" type="text" value="" title="" id="fld2">
HTML code for Delivery Address
<input data-bind="value: $data.editor.SearchHouseNumber, uniqueId: $data.editor.SearchHouseNumber, valueUpdate: ['blur', 'afterkeydown', 'onload'], css: $data.editor.labelClass" maxlength="100" name="customerSearchHouseNumber" placeholder="House no." size="24" type="text" value="" title="" id="fld17">
As far as I can tell, Chrome actually implements the full autocomplete spec here, which means you should be able to specify which type of data Chrome should use to fill in the fields. Therefore, you can add the following attributes to your inputs:
autocomplete="billing street-address" and autocomplete="shipping street-address", and Chrome will likely be able to supply the correct values.
Note that street-address designation can take multiline values (as per spec), so you may prefer address-line1.
Example:
<input name="billing_address" id="fld2" autocomplete="billing street-address">

Prevent Browser caching password fields

How to prevent browser from remembering the password fields ... especially FireFox ( using jsf 2.0.9 ) I tried autocomplete= "off" ,still not working , Is there any possibility for this without migrating to jsf 2.2 ? Am using "h:inputSecret"
The autocomplete attribute is ignored and therefore not rendered in the output html. I had a similar problem, i wanted to use placeholder attribute. I ended up using jquery to accommodate the need
<script type="text/javascript">
jQuery(document).ready(function() {
document.getElementById("entityForm:searchField").setAttribute('placeholder','Search');
});
</script>
You can use this to set the autocomplete attribute
document.getElementById("passwordField").setAttribute('autocomplete','off');
You will never find a way to achieve this, cause the autocomplete in this case is happening on the client-side.
You can make it a little more difficult, but at the end of a day it's the users browser which decideds whether to store a password or not. If a user wants to store the password, he can always do it. (A Lot of Browsers are simply ignoring things like autocomplete="false", because its a user decision, nothing the website should decide.)
Hi all thanks fr yur solutions , Fixed the issue , just made some work around so that code is compatable with both Firefox and Chrome ,
Use "p:inputText"(Primefaces Component) instead of "h:inputSecret"
Code :
p:inputText onfocus="validate('Id')"
use javascript to change type to "password" upon focus :
function validate(Id){
document.getElementById(pwd).type = 'password'};
then comes the important workaround,adding tags before and after
<input type="text" name="faketext" id="faketext" style="display:none;"/>
<input type="password" value=" " name="fakepassword" id="fakepassword" style="display:none;" />
<!-- - After <p:inputText> -->
<input type="password" value=" " name="fakepassword1" id="fakepassword1" style="display:none;"/>
Thus issue Resolved.

Refer the id variable of logic - iterate using jstl-el

Facing a unusual challenge :
//Code
<logic:iterate id="list" name="accountRouteConfigListForm" property="valueList" indexId="incr">
<div <custom:align defaultAlign="left"/>>
<html:select name="list" property="accountStatus" onchange="onChangeStatus(${list.accName})"> //This is not working, how to refer accName in list
<html:option value="<%= String.valueOf(Constants.ENABLED) %>">
</html:option>
<html:option value="<%= String.valueOf(Constants.DISABLED) %>">
</html:option>
How do i refer a field inside a list and pass it as an argument to onChangeStatus
First, it seems you are missing an end tag for <logic:iterate> in your example code.
Second, unless you have a very good reason, try to use JSTL instead of the outdated struts custom tags. It's always good to stay with standards, right?
In your case, that would look like this:
<c:forEach items="${accountRouteConfigListForm.valueList}" var="list">
....
</c:forEach>

Error when rendering a Alloy UI form in Liferay

This is a form in my Liferay portlet.
<aui:form method="post" action="<%=loginURL%>">
<aui:fieldset>
<aui:input name="userName" label="Usernam">
<aui:validator name="required">
</aui:validator>
</aui:input>
<aui:input name="password" label="Password" type="password"></aui:input>
<aui:button type="submit" value="Login"></aui:button>
</aui:fieldset>
</aui:form>
When I deploy the portlet and go to the page that contains this form I get this error:
The aui:validator tag declares that it accepts dynamic attributes but does not implement the required interface.
I don't understand the problem. How can I fix it? Any help is appreciated in advance.
I don't understand the problem.
This answer will help you understand the problem in detail, though the answer is for spring tag still it applies to all custom tags created for JSP.
How can I fix it?
You can fix it by referencing the correct updated jar (util-taglib.jar) & including the correct TLD (aui.tld) inside WEB-INF/tld/ for your custom portlet.

How to get form field array in play framework

I'm using groovy to render templates in Play framework. I have a checkbox inside a list loop:
<input type="checkbox" name="chkUser[]" id="chkUser{users.getId()}" value="${users.getId()}">
How can i get the state of the checkbox array in Controller page.
Came across this a couple of monthes ago. It seems you can use find those back in controller using :
public static myFormFunction(boolean[] chkUser) {
...
Not sure of it and I cannot check this right now.
Take a look at the official documentation.
It can be achieved using hidden fields for every checkbox.
<input type="hidden" name="HdChkUser${users.getId()}">
<input type="checkbox" name="ChkUser${users.getId()}">
If the state of the checkbox changes then updating the hidden field value. Which can be used in for msubmission.

Resources