Henner,

 

I’m attaching file \tomcat\webapps\bookstore\tests\testAuthorBooksSubFormWithJavascriptFieldsArray.jsp

 

1-     Load the page

2-     Click on the last row of the “Click here to check!” field on the subform. Everything should be ok.

3-     Hit the new button on the subform.

4-     Click on the “Click here to check!” field. You should get an error.

5-     Click on the IE back button and refresh the page.

6-     Click on the last row again of the “Click here to check!” field. You should get an error again.

 

Thanks,

 

Julio

 


From: Henner Kollmann [mailto:[EMAIL PROTECTED]
Sent: Friday, November 12, 2004 2:05 PM
To: 'Julio Ortuzar O.'
Cc: [EMAIL PROTECTED]
Subject: AW: [dbforms] Possible bug in

 

Could you build a test page based on the bookstore example to reproduce?

 

Thanks

Henner

 


Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Julio Ortuzar O.
Gesendet: Freitag, 12. November 2004 17:40
An: 'Henner Kollmann'
Cc: [EMAIL PROTECTED]
Betreff: RE: [dbforms] Possible bug in

2.4_20040804

 

Thx,

 

Julio

 


From: Henner Kollmann [mailto:[EMAIL PROTECTED]
Sent: Friday, November 12, 2004 5:42 AM
To: 'Julio Ortuzar O.'
Cc: [EMAIL PROTECTED]
Subject: AW: [dbforms] Possible bug in

 

Which version do you use?

 

regards,

 

Henner

 


Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Julio Ortuzar O.
Gesendet: Donnerstag, 11. November 2004 22:20
An: [EMAIL PROTECTED]
Betreff: [dbforms] Possible bug in

Hi,

 

I have a form with another nested form. Problem occurs when I use _javascript_FieldsArray on both to get the _javascript_ Fields Arrays.

 

The fields with * below belong to the subform. If you notice, the “_ins0” variable is at pos (length-2) instead of (length-1) as I should be. At least that is the real name of the input variable in html when inserting a new row.

 

This means I’m getting an error when I fetch the var name on navnew event since it gives for example "[EMAIL PROTECTED]@root_1" instead of "[EMAIL PROTECTED]".

 

 

<SCRIPT language="_javascript_">

<!--

 

    var dbFormFields = new Array();

    dbFormFields["dispatch_whouse_type_id_from"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_4");

    dbFormFields["dispatch_freight_cost"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_9");

*   dbFormFields["product_amount"] = new Array("[EMAIL PROTECTED]@root_5", "[EMAIL PROTECTED]@root_5", "[EMAIL PROTECTED]", "[EMAIL PROTECTED]@root_5");

    dbFormFields["dispatch_freight_cost_curr"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_10");

    dbFormFields["dispatch_whouse_id_to"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_7");

*   dbFormFields["dispatch_rcpt_type_id"] = new Array("[EMAIL PROTECTED]@root_1", "[EMAIL PROTECTED]@root_1", "[EMAIL PROTECTED]", "[EMAIL PROTECTED]@root_1");

*   dbFormFields["product_id"] = new Array("[EMAIL PROTECTED]@root_4", "[EMAIL PROTECTED]@root_4", "[EMAIL PROTECTED]", "[EMAIL PROTECTED]@root_4");

    dbFormFields["dispatch_whouse_type_id_to"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_6");

    dbFormFields["dispatch_movement_date"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_8");

    dbFormFields["dispatch_rut_dv"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_2");

*   dbFormFields["product_type_id"] = new Array("[EMAIL PROTECTED]@root_3", "[EMAIL PROTECTED]@root_3", "[EMAIL PROTECTED]", "[EMAIL PROTECTED]@root_3");

    dbFormFields["dispatch_company_rut"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_1");

    dbFormFields["dispatch_rcpt_num"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_3");

*   dbFormFields["production_id"] = new Array("[EMAIL PROTECTED]@root_8", "[EMAIL PROTECTED]@root_8", "[EMAIL PROTECTED]", "[EMAIL PROTECTED]@root_8");

    dbFormFields["dispatch_obs"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_11");

    dbFormFields["dispatch_whouse_id_from"] = new Array("[EMAIL PROTECTED]", "f_30_insroot_5");

 

    function getDbFormFieldName(name){

      return getDbFormFieldName(name,null);

    }

 

 

    function getDbFormFieldName(name,pos){

      var result = dbFormFields[name];

      if(pos==null) return result[result.length-1];

      return result[pos];

    }

--></SCRIPT>

 

 

Rgds,

 

Julio

<html>
        <%@ taglib uri="/WEB-INF/dbforms.tld" prefix="db" %>
        <head>
           <db:base />
           <target="_top">
        </head>
   <body>
      <db:dbform autoUpdate="false" 
                 
followUp="/tests/testAuthorBooksSubFormWithJavascriptFieldsArray.jsp" 
                 maxRows="1" 
                 tableName="AUTHOR" 
                                 javascriptFieldsArray="true"
                 
      >
         <db:header>
                 <h1 align="center">Edit Authors</h1>
                 <db:errors/>
         </db:header>
         <db:body>
            <table class="fixed" align="center">
               <tr class="even">
                     <td style="width:300px">ID</td>
                                 <td style="width:100px"><db:label 
fieldName="AUTHOR_ID"/>&nbsp;</td>
               </tr>
               <tr class="odd">
                    <td style="width:300px">NAME</td>
                    <td style="width:300px"><db:textField size="25" 
fieldName="NAME"/></td>
               </tr>
               <tr class="even">
                    <td>ORGANISATION</td>
                    <td><db:textField size="25" fieldName="ORGANISATION"/>
                    </td>
               </tr>
            <tr class="button">
               <td colspan="2" style="text-align:center">
                 <db:updateButton style="width:100" caption="Save"/>
                 <db:deleteButton style="width:100" caption="Delete"/>
                 <db:insertButton style="width:100" caption="Insert" 
showAlways="false" />
               </td>
            </tr>
            <tr class="button">
               <td colspan="2" style="text-align:center">
                 <db:navFirstButton style="width:100" caption="<< First"/>
                 <db:navPrevButton  style="width:100" caption="<  Previous"/>
                 <db:navNextButton  style="width:100" caption=">  Next"/>
                 <db:navLastButton  style="width:100" caption=">> Last"/>
                 <db:navNewButton   style="width:100" caption="New"  
showAlwaysInFooter="false"/>
                 <db:navCopyButton  style="width:100" caption="Copy" 
showAlwaysInFooter="false"/>
                 &nbsp;
               </td>
            </tr>
                    <tr>
                                <td colspan="2" style="text-align:center">
                                        <h2>sub form</h2>
                                </td>
                        </tr>
                    <tr><td colspan="2" style="text-align:center">
<% 
        int iPos = 0;
%>                      
                            <db:dbform 
                                autoUpdate="false" 
                                
followUp="/tests/testAuthorBooksSubFormWithJavascriptFieldsArray.jsp"   
                                maxRows="*" 
                                tableName="BOOK"
                                parentField="AUTHOR_ID"
                                childField="AUTHOR_ID"                          
                                orderBy="ISBN" 
                                        javascriptFieldsArray="true" 
                            >
                         <db:header>
                                        <table>
                                 </db:header>
                         <db:body allowNew="true">
                   <tr>
                          <td><db:label fieldName="BOOK_ID"/>&nbsp;</td>
<% 
        String strGetDbFormFieldName = "";
        String strOnFocus = "";
        strGetDbFormFieldName = "getDbFormFieldName('ISBN', ";
        if (currentRow_BOOK == null) {
                strGetDbFormFieldName += "null";
        }
        else{
                strGetDbFormFieldName += iPos;
        }
        strGetDbFormFieldName += ")";
        strOnFocus  = "javascript:";
        strOnFocus += "if (" +  strGetDbFormFieldName + " == this.name){";
        strOnFocus +=     "alert('OK! Vars are equal in name:\\n\\n' + ";
        strOnFocus +=     "'getDbFormFieldName=' + " + strGetDbFormFieldName +" 
+ '\\n' + ";
        strOnFocus +=     "'this.name=' + this.name);";
        strOnFocus += "}";
        strOnFocus += "else{";
        strOnFocus +=     "alert('ERROR! Vars differ in name:\\n\\n' + ";
        strOnFocus +=     "'getDbFormFieldName=' + " + strGetDbFormFieldName +" 
+ '\\n' + ";
        strOnFocus +=     "'this.name=' + this.name);";
        strOnFocus += "}";
        

%>
                      <td>
                                                <db:textField fieldName="ISBN" 
overrideValue="Click here to check!" onFocus="<%=strOnFocus%>"/>
                                                <db:textField 
fieldName="ISBN"/>&nbsp;
                                          </td>
                          <td><db:textField fieldName="TITLE" /> </td>
                          <td>
                                                         <db:updateButton 
style="width:100" caption="Save"/>
                                                         <db:deleteButton 
style="width:100" caption="Delete"/>
                                                         <db:insertButton 
style="width:100" caption="Insert" showAlways="false" />
                                          </td>
                       </tr>                                                    
                        
<% iPos++; %>                                                      
                                 </db:body>
                         <db:footer>
                                          <tr class="button">
                                                <td colspan="4" 
style="text-align:center">
                                                        <db:navFirstButton 
style="width:100" caption="<< First"/>
                                                        <db:navPrevButton  
style="width:100" caption="<  Previous"/>
                                                        <db:navNextButton  
style="width:100" caption=">  Next"/>
                                                        <db:navLastButton  
style="width:100" caption=">> Last"/>
                                                        <db:navNewButton   
style="width:100" caption="New"/>
                                        <db:navCopyButton  style="width:100" 
caption="Copy"/>
                                                        &nbsp;
                                                </td>
                                          </tr>
                                        <table>
                         </db:footer>
                                </db:dbform>    
                        </td></tr>
         </db:body>
         <db:footer>
           </table>
         </db:footer>
      </db:dbform>

<%@ include file="httpSnooper.jsp" %> 

   </body>
</html>

        
        

        

Reply via email to