Announcement Announcement Module
Collapse
No announcement yet.
how to make a password field? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to make a password field?

    hi all,

    I have the create.jspx generated as below:
    =====
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <div xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:field="urn:jsptagdir:/WEB-INF/tags/form/fields" xmlns:form="urn:jsptagdir:/WEB-INF/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:spring="http://www.springframework.org/tags" version="2.0">
    <jsp:output omit-xml-declaration="yes"/>
    <form:create id="fc_forecast_sys_data_domain_Users" modelAttribute="users" path="/userses" render="${empty dependencies}" z="afcduv4j1LHXaWZ3mVr+OI/xWPg=">
    <field:input field="name" id="c_forecast_sys_data_domain_Users_name" max="30" required="true" z="e8go7vl7a9EDGGXGfHo7JnTLx0w="/>
    <field:input field="password" id="c_forecast_sys_data_domain_Users_password" max="30" required="true" z="FCdzpqhJwYiPRAEHeAd2eUfnhMk="/>
    <field:input field="email" id="c_forecast_sys_data_domain_Users_email" max="30" validationMessageCode="field_invalid_email" z="fUNvhSF+fHl3HfMEXlmyA6h/0+s="/>
    </form:create>
    <form:dependency dependencies="${dependencies}" id="d_forecast_sys_data_domain_Users" render="${not empty dependencies}" z="ioB4jcoM2nXJnv/nDDuELgrRXac="/>
    </div>
    =====

    I would like to have the <field:input field="password" ... to be a real password field, that is, when I input password, it will show "***", how to do that?

    Thanks a lot.

  • #2
    can any one please help? Thanks!

    Comment


    • #3
      I was looking for this feature, too. It's addressed here for an upcoming release: https://jira.springframework.org/browse/ROO-1133

      If you can't wait, you can modify your own input.tagx file to make the same accommodation as suggested in the jira.

      Comment


      • #4
        reply how to make a password field

        you can be added to input.tagx
        <jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:spring="http://www.springframework.org/tags" xmlns:form="http://www.springframework.org/tags/form" xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
        <jsp:output omit-xml-declaration="yes"/>

        <jsp:directive.attribute name="id" type="java.lang.String" required="true" description="The identifier for this tag (do not change!)"/>
        <jsp:directive.attribute name="field" type="java.lang.String" required="true" description="The field exposed from the form backing object"/>
        <jsp:directive.attribute name="label" type="java.lang.String" required="false" description="The label used for this field, will default to a message bundle if not supplied"/>
        <jsp:directive.attribute name="required" type="java.lang.Boolean" required="false" description="Indicates if this field is required (default false)"/>
        <jsp:directive.attribute name="disabled" type="java.lang.Boolean" required="false" description="Specify if this field should be enabled"/>
        <jsp:directive.attribute name="validationRegex" type="java.lang.String" required="false" description="Specify regular expression to be used for the validation of the input contents"/>
        <jsp:directive.attribute name="validationMessageCode" type="java.lang.String" required="false" description="Specify the message (message property code) to be displayed if the regular expression validation fails"/>
        <jsp:directive.attribute name="validationMessage" type="java.lang.String" required="false" description="Specify the message to be displayed if the regular expression validation fails"/>
        <jsp:directive.attribute name="min" type="java.lang.String" required="false" description="Specify the minimum length of the input contents"/>
        <jsp:directive.attribute name="max" type="java.lang.String" required="false" description="Specify the maximum length of the input contents"/>
        <jsp:directive.attribute name="decimalMin" type="java.lang.String" required="false" description="Specify the minimum size of the input contents"/>
        <jsp:directive.attribute name="decimalMax" type="java.lang.String" required="false" description="Specify the maximum size of the input contents"/>
        <jsp:directive.attribute name="disableFormBinding" type="java.lang.Boolean" required="false" description="Set to true to disable Spring form binding"/>
        <jsp:directive.attribute name="render" type="java.lang.Boolean" required="false" description="Indicate if the contents of this tag and all enclosed tags should be rendered (default 'true')" />
        <jsp:directive.attribute name="z" type="java.lang.String" required="false" description="Used for checking if element has been modified (to recalculate simply provide empty string value)"/>
        <jsp:directive.attribute name="password" type="java.lang.Boolean" required="false" description="Specify if this field should be a password field"/>

        <c:if test="${empty render or render}">

        <c:if test="${empty disabled}">
        <c:set value="false" var="disabled"/>
        </c:if>

        <c:if test="${empty label}">
        <spring:message code="label_${fn:toLowerCase(fn:substringAfter(id, '_'))}" var="label"/>
        </c:if>

        <c:if test="${empty required}">
        <c:set value="false" var="required"/>
        </c:if>

        <c:if test="${empty password}">
        <c:set value="false" var="password"/>
        </c:if>

        <div id="_${id}_id">
        <label for="_${field}_id"><c:out value="${label}"/>:</label>
        <c:choose>
        <c:when test="${disableFormBinding}">
        <c:if test='${password == "true"}'>
        <input id="_${field}_id" name="${field}" type="password"/>
        </c:if>
        <c:if test='${password == "false"}'>
        <input id="_${field}_id" name="${field}" />
        </c:if>

        </c:when>
        <c:otherwise>
        <c:if test='${password == "true"}'>
        <formassword id="_${field}_id" path="${field}" disabled="${disabled}"/>
        </c:if>
        <c:if test='${password == "false"}'>
        <form:input id="_${field}_id" path="${field}" disabled="${disabled}"/>
        </c:if>
        <br/>
        <form:errors cssClass="errors" id="_${field}_error_id" path="${field}"/>
        </c:otherwise>
        </c:choose>
        <spring:message arguments="${label}" code="field_invalid" var="field_invalid"/>
        <c:choose>
        <c:when test="${required}">
        <spring:message code="field_required" var="field_required"/>
        <spring:message argumentSeparator="," arguments="${label},(${field_required})" code="field_simple_validation" var="field_validation"/>
        </c:when>
        <c:otherwise>
        <spring:message argumentSeparator="," arguments="${label}, " code="field_simple_validation" var="field_validation"/>
        </c:otherwise>
        </c:choose>

        <script type="text/javascript">Spring.addDecoration(new Spring.ElementDecoration({elementId : '_${field}_id', widgetType : 'dijit.form.ValidationTextBox', widgetAttrs : {promptMessage: '${field_validation}', invalidMessage: '${field_invalid}', required: ${required}}})); </script>
        </div>
        <br/>

        </c:if>
        </jsp:root>

        Comment

        Working...
        X