struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (WW-4718) focusElement form attribute not working
Date Thu, 24 Nov 2016 07:41:58 GMT

    [ https://issues.apache.org/jira/browse/WW-4718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15692494#comment-15692494
] 

Lukasz Lenart edited comment on WW-4718 at 11/24/16 7:41 AM:
-------------------------------------------------------------

If you are using the Bootstrap plugin you can simple override its {{form-close.ftl}} template
by creating a file {{template/bootstrap/form-close.ftl}}

{code:xml}
<#include "/${parameters.templateDir}/bootstrap/control-close.ftl" />
<#include "/${parameters.templateDir}/simple/form-close.ftl" />
<script type="text/javascript">
    if (typeof jQuery != 'undefined') {
        if (typeof jQuery.fn.tooltip == 'function') {
            jQuery('i.s2b_tooltip').tooltip();
        }
    }
</script>

<#if parameters.focusElement??>
<script type="text/javascript">
    if (typeof jQuery != 'undefined') {
        jQuery(document).ready(function() {
            var element  = jQuery("#${parameters.focusElement?html}");
            if(element) {
                element.focus();
            }
        });
    }
</script>
</#if>
{code}


was (Author: lukaszlenart):
If you are using the Bootstrap plugin you can simple override its {{form-close.ftl}} template
by create a file {{template/bootstrap/form-close.ftl}}

{code:xml}
<#include "/${parameters.templateDir}/bootstrap/control-close.ftl" />
<#include "/${parameters.templateDir}/simple/form-close.ftl" />
<script type="text/javascript">
    if (typeof jQuery != 'undefined') {
        if (typeof jQuery.fn.tooltip == 'function') {
            jQuery('i.s2b_tooltip').tooltip();
        }
    }
</script>

<#if parameters.focusElement??>
<script type="text/javascript">
    if (typeof jQuery != 'undefined') {
        jQuery(document).ready(function() {
            var element  = jQuery("#${parameters.focusElement?html}");
            if(element) {
                element.focus();
            }
        });
    }
</script>
</#if>
{code}

> focusElement form attribute not working
> ---------------------------------------
>
>                 Key: WW-4718
>                 URL: https://issues.apache.org/jira/browse/WW-4718
>             Project: Struts 2
>          Issue Type: Bug
>    Affects Versions: 2.3.24, 2.5.5
>         Environment: internet explorer
> chrome
>            Reporter: Chad Davis
>            Assignee: Lukasz Lenart
>             Fix For: 2.5.6
>
>
> I cannot get the focusElement attribute on the form tag to work. I've tried it in both
IE and chrome and in neither case will the text field I want to focus when the page loads
do so.
> Here is the html for the form I'm trying to do this with:
> {code:xml}
> <s:form action="ViewSubscriber" method="GET" cssClass="form-group"
>         focusElement="subscriberListAutocomplete">
>     <div class="input-group">
>         <s:textfield name="subscriberName" 
>                      id="subscriberListAutocomplete" 
>                      cssClass="subscriberListAutocomplete form-control"
>                      placeholder="Subscriber Name"
>                      tabindex="1"/>
>         <span class="input-group-btn">
>             <s:submit value="View Subscriber" 
>                       cssClass="btn btn-success"
>                       tabindex="0"/>
>         </span>
>     </div>
> </s:form>
> {code}
> If I change the textfield to a basic input element and use html's autofocus attribute,
it works fine. I have no idea what else I can try on this.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message