Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2393

s:submit doesn't work in IE7 when submitting a s:form that contains a textfield named "id"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • Plugin - Dojo Tags
    • None

    Description

      Using the s:submit tag in order to post data from a s:form that contanis a textfield named "id" doesn't in IE7.
      After doing some debug I found a problem in the javascript generated by dojo plugin (dojo.js), specifically in the dojo.byId function. There, it looks for a form with the given id. At first it works well, but then it checks if the id of the found element is the same of the given id. If the form contains a textfield with the name "id", the function returns wrond value.

      Here's the dojo source with some comments...

      dojo.byId=function(id,doc){

      if((id)&&((typeof id=="string")||(id instanceof String))){
      if(!doc)

      { doc=dj_currentDocument; }

      var ele=doc.getElementById(id);

      //*************
      // If you have a for with a textfield with the name "id" the
      // test (ele.id!=id) always returns false....
      //*************
      if(ele&&(ele.id!=id)&&doc.all){
      ele=null;
      eles=doc.all[id];

      if(eles){
      //****************************
      // Here's the problem ... "eles.length" is
      // not the number of forms with the same id, but rather,
      // the number of the inner elements of the form...
      // textfields, for example
      //****************************
      if(eles.length){
      for(var i=0;i<eles.length;i++){
      if(eles[i].id==id)

      { ele=eles[i]; break; }

      }

      }else

      { ele=eles; }


      } }
      return ele; }
      return id; };

      Some pieces of the source I coded:

      <s:form id="formId" theme="ajax" namespace="/ajax" method="post" ...>
      <s:textfield label="Id" name="id" cssClass="textfield"/>
      </s:form>

      the submit button (outer):
      <s:submit formId="formId" targets="list" theme="ajax" .../>

      the s:div
      <s:div id="list" ...></s:div>

      Attachments

        Activity

          People

            lukaszlenart Lukasz Lenart
            volceri.davila Volceri D Avila
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: