Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    #16
    No, it's not working with getParams either.
    Here is complete client code:
    <code>
    <HTML><HEAD>
    <SCRIPT>var isomorphicDir="../../common/isomorphic/";</SCRIPT>
    <SCRIPT SRC=../../common/isomorphic/system/modules/ISC_Core.js></SCRIPT>
    <SCRIPT SRC=../../common/isomorphic/system/modules/ISC_Foundation.js></SCRIPT>
    <SCRIPT SRC=../../common/isomorphic/system/modules/ISC_Containers.js></SCRIPT>
    <SCRIPT SRC=../../common/isomorphic/system/modules/ISC_Grids.js></SCRIPT>
    <SCRIPT SRC=../../common/isomorphic/system/modules/ISC_Forms.js></SCRIPT>
    <SCRIPT SRC=../../common/isomorphic/system/modules/ISC_DataBinding.js></SCRIPT>
    <SCRIPT SRC=../../common/isomorphic/skins/SmartClient/load_skin.js></SCRIPT>
    </HEAD><BODY>
    <SCRIPT>
    isc.DataSource.create({
    ID:"countryDS",
    dataFormat:"xml",
    dataURL:"accidents.asp?datarequest=xml&methodexecute=",
    recordXPath:"//country",
    fields:[
    {name:"countryCode", title:"Code"},
    {name:"countryName", title:"Country"},
    {name:"independence", title:"Nationhood", type:"date"},
    {name:"population", title:"Population", type:"integer"},
    {name:"gdp", title:"GDP", type:"float"}
    ]
    });
    /*isc.ListGrid.create({
    ID: "countryList",
    width:500, height:224,
    alternateRecordStyles:true,
    showAllRecords:true,
    dataSource: countryDS,
    autoFetchData: true
    });*/

    isc.DynamicForm.create({
    ID:"frmFileIdAction",
    dataSource: countryDS,
    top: 20,
    // numCols: "5",
    border:"1px solid blue", padding:5,
    // colWidths: ["12%", "10%", "10%", "10%", "*"],
    fields:[
    {name: "ActionCode", title: "Action Code", type: "select",
    valueMap:
    {
    "1" : "Create New",
    "2" : "Update",
    "3" : "Delete",
    "4" : "Print/View"
    }
    },
    {name: "BRCFile", title: "BRC File Number", type: "Integer", length: "4", width: "50"}
    ]
    });
    isc.DynamicForm.create({
    ID:"frmGeneral",
    dataSource: countryDS,
    numCols: 5,
    colWidths: ["12%", "3%", "10%", "4%", "*"],
    wrapItemTitles:false,
    fields:[
    {name:"DateOfAccident", title:"Date Of Accident", type:"date",
    useTextField:true, width: 100, endRow: true, colSpan:2
    },

    {name: "RailRoadInvolved", title: "Other RailRoad Involved", type: "select",
    colSpan:2,
    valueMap:{"1" : "N/A"}
    },

    {name: "RailRoadInvolvedFile", title: "File Number", type: "Integer",
    length: 4, width: 50},

    {name: "RailRoadResponsible", title: "RailRoad Responsible For Track",
    type: "select", colSpan:2,
    valueMap:{"1" : "BRC"}
    },

    {name: "RailRoadResponsibleFile", title: "File Number", type: "Integer",
    length: 4, width: 50
    },

    {name: "TimeOfAccident", title: "Time Of Accident", type: "time",
    endRow: true, colSpan:2},

    {name: "Yard", title: "Yard", type: "select", endRow: true,
    colSpan:2,
    valueMap:{"1" : "ECLS"}
    },

    {name: "Division", title: "Division", type: "select", endRow: true,
    colSpan:2,
    valueMap:{"1" : "System"}
    },

    {name: "NearestCityOrTown", title: "Nearest City Or Town",
    type: "select", endRow: true, colSpan:2,
    valueMap:{"1" : "Badford Park"}
    },

    {name: "IndustryNumber", title: "Industry Number", type: "Integer",
    length: 2, width: 25, colSpan:2
    },

    {name: "SpecificSiteTrackNumber", title: "Specific Site/Track",
    type: "Integer", length: 2, width: 25, startRow: true
    },

    {name: "SpecificSiteTrackName", showTitle: false, type: "text",
    length: 20, width: 50
    },

    {name: "TypeOfTrack", title: "Type Of Track", type: "select",
    startRow: true, colSpan:2,
    valueMap:{
    "1" : "Yard",
    "2" : "Main",
    "3" : "Siding",
    "4" : "Industry"
    }
    },

    {name: "MilePostNumber", title: "Mile Post Number", type: "float",
    length: 10, width: 50, startRow: "true", colSpan:2
    },

    {name: "Weather", title: "Weather", type: "select", startRow: true,
    colSpan:2,
    valueMap:{
    "1" : "Clear",
    "2" : "Cloudy",
    "3" : "Rain",
    "4" : "Fog",
    "5" : "Sleet",
    "6" : "Snow"
    }
    }
    ]

    });

    isc.TabSet.create({
    ID: "tabSet",
    width: "100%",
    height: "100%",
    tabs: [{
    id: "General",
    title: "General",
    pane: frmGeneral

    },{
    id: "Consists1",
    title: "Consists #1"
    }]
    });
    isc.IButton.create({
    ID: "Process",
    name: "Process",
    title: "Process",
    type: "button",
    // top: 370,
    left: 40,
    click :
    function ()
    {
    originaldataURL = countryDS.dataURL;
    countryDS.dataURL = countryDS.dataURL + 'mProcessAccidentFileRequest';
    countryDS.dataProtocol = 'getParams';
    frmGeneral.saveData();
    countryDS.dataURL = originaldataURL;
    }
    });

    isc.VLayout.create({
    width:"100%", height:"100%",
    members:[
    isc.Canvas.create({
    ID:"TopFrame",
    showEdges:false,
    width:"100%",
    height:"8%",
    autoDraw:false
    }),
    isc.HLayout.create({
    width:"100%",
    members:[
    isc.Canvas.create({
    ID:"LeftFrame",
    backgroundColor:"#CCFFCC",
    showEdges:true,
    width:"20%",
    autoDraw:false
    }),
    isc.VLayout.create({
    ID:"RightFrame",
    showEdges:true,
    autoDraw:false,
    width:"*",
    backgroundColor:"#63CCCC",
    members:[frmFileIdAction, tabSet, Process]
    })

    ]

    })
    ]
    });
    countryDS.fetchData(null, "frmGeneral.setValues(data[0])");
    </SCRIPT>
    </BODY></HTML>
    </code>

    Comment


      #17
      Works for me. I:

      1. dropped this into a stock SmartClient 5.6 Evaluation package

      2. created a simple data file:

      Code:
      <List>
          <country>
             <RailRoadInvolved>1</RailRoadInvolved>
             <Yard>2</Yard>
          </country>
      </List>
      .. and set the initial dataURL to point to this file

      3. used Fiddler to see the request generated when I press the "Process" button. I see the parameters:
      "?RailRoadInvolved=1&Yard=2" added to the end of the dataURL as expected.

      Aside from some problem in your .asp code, the only thing I can think of is that you may be expecting to see blank parameters for blank fields, eg "RailRoadInvolved=&Yard=&DateOfAccident="?

      Comment


        #18
        I am checking Count property and it's 0. I am using same asp page with your product and with my test page. My asp code works fine in testing mode.
        Give me another way to send data back. Maybe the alternative way will work.
        Have you noticed that my code has two dynamic forms. That's not a problem, right?

        Comment


          #19
          Are you checking Request.QueryString.Count? As previously mentioned, if you switch to dataProtocol:"getParams", data arrives in the query string.

          Comment


            #20
            No, I am checking it when I do post.
            This is from Fiddler when I click on a button with saveData code:
            QUERYSTRING ====
            datarequest=xml
            methodexecute=mProcessAccidentFileRequest

            Comment


              #21
              Again:

              1. set dataProtocol:"getParams"
              2. ensure there is data in at least one form field
              3. press "Process" in your UI

              On the server, Request.QueryString will have the data. Fiddler will show it under the QueryString tab as well as simply in the URL field of the "HTTP Sessions" grid.

              Comment


                #22
                Ok, with getParams it works. Will check post again.

                Comment


                  #23
                  Still when I use postParams I get zero for form's Count

                  Comment


                    #24
                    Adding the following to your DataSource with dataProtocol:"postParams" may make Request.Form work:

                    Code:
                        transformRequest : function (dsRequest) {
                           dsRequest.contentType = "application/x-www-form-urlencoded; charset=UTF-8";
                            return dsRequest.data;
                        }
                    If not, we'd recommend proceeding with dataProtocol:"getParams" unless there's some reason that won't work for you.

                    Comment


                      #25
                      What do I need to add? New function or contentType property setting?

                      Comment


                        #26
                        What was posted was the literal code to add.

                        Your modified DataSource definition should look like this:

                        Code:
                        isc.DataSource.create({
                        	ID:"countryDS",
                        	dataFormat:"xml",
                                dataProtocol:"postParams",
                                transformRequest : function (dsRequest) {
                                     dsRequest.contentType = "application/x-www-form-urlencoded; charset=UTF-8";
                                     return dsRequest.data;
                                },
                        	dataURL:"accidents.asp?datarequest=xml&methodexecute=",
                        	recordXPath:"//country",
                                fields:[
                                {name:"countryCode", title:"Code"},
                                {name:"countryName", title:"Country"},
                                {name:"independence", title:"Nationhood", type:"date"},
                                {name:"population", title:"Population", type:"integer"},
                                {name:"gdp", title:"GDP", type:"float"}
                            ]
                         });

                        Comment


                          #27
                          Yes, that helped.
                          Can you briefly explain why?

                          Comment


                            #28
                            It's not completely clear. Your server was ignoring form parameters that other servers will accept. An explicit charset setting in the content-type HTTP header was the only detectable difference in sample requests known to work vs the request SmartClient was sending, and that seems to correct the problem, so we've made it the new default.

                            Comment


                              #29
                              Dont know if it makes any difference but I am working with IE7 on Vista.

                              Comment


                                #30
                                It doesn't, we test browser variations down to the granularity of what service packs are installed. This issue is specific to your server configuration, and although the cause is not completely clear, the next version of SmartClient will automatically use the workaround we just applied to your application (explicit contentType w/charset).

                                Comment

                                Working...
                                X