10 Replies Latest reply on Dec 19, 2007 9:13 AM by luciewong

    LoadVars / POST

    luciewong Level 1
      I have a problem using Load Vars together with "POST".

      I am loading from a DB the complete data of a Table to a DataGrid using Load Vars (sendAndLoad method, "GET")
      and ASP.
      Works perfect, all data is in the Grid, even with more than 100 columns.
      I make changes to the Data in the Grid and now I want to send all data back to the DB,
      using LoadVars again. I am sending, as it is a Grid, data Objects.

      When I use
      getDisp_lv.sendAndLoad("updateTable.asp", recDisp_lv, "GET");
      everything works fine, but ..only with a lower number of records, maybe up to 50.

      So I thought, if there are probably 500 records, I will use "POST" method, but this does not work at all.
      Any ideas what I could do to use POST.

      Thank you for your help.
        • 1. Re: LoadVars / POST
          Damon Edwards Level 3
          make sure your asp is set to receive the variables through the post method. Never worked with asp, but this is how it would look in php,

          $myVariable = $_POST['variable'];

          while the GET would look like this

          $myVariable = $_GET['variable'];
          • 2. Re: LoadVars / POST
            Level 7
            Post won't work in the authoring environment. You didn't say how you were
            testing, but since you said it doesn't work at all, I'd guess that's it. You
            need to work from the browser, if you want Post to work.

            Dave -
            Head Developer
            Adobe Community Expert

            • 3. Re: LoadVars / POST
              luciewong Level 1
              Hi dzedward,
              Yes this could be the reason.
              The usual ASP would look like:
              rs("HFWeight") = request("pHFWeight")

              But this time I don't have the Column names to update, because I retrieved the data also dynamic.
              So I must write like this:

              Do While x < noC
              itemF = rs.Fields(x).name <<this will define the column names to update"
              rs.Fields(x).Value = request.QueryString(itemF) <where "itemF" is not a real request

              ...the data comes in to ASP, but not the name "itemF" as a real request. So this could be the reason, why POST doesn't work.
              But now, how I can write the ASP that it reads "itemF" as a request?
              As you are also not this ASP Pro, maybe someone can help us.
              Thank you.

              • 4. Re: LoadVars / POST
                luciewong Level 1
                And Dave, thank you for the reply,
                I am working on on the Browser and GET and POST works usually, but this is a quite complicate issue.
                I retrieve all data dynamic, the only thing I know is the Database Name and the Table,
                I write out all data in the Table, put it in a Grid as Objects, then change some data and send the complete table back to the server, using LoadVars(sendAndLoad).
                I think it will be the ASP.
                Thank you.
                • 5. LoadVars / POST
                  luciewong Level 1
                  Below is my code,
                  it could be, that I assign the value wrong to the LV. If I use POST, then there should be probably some ampersand or "=", so the ASP can read it correctly? But in GET all works in smaller numbers of records.
                  while(e<recNo){ //<<no of records<
                  var item:Object = {};
                  //to each column>except column 0>
                  var myStr:String = colArray[d]+e; //<<gives me the column names
                  var myRec:Object = new Object();
                  myRec = (myGrid.getItemAt(e)[myGrid.getColumnAt(d).columnName]);//<<gives me the value in the cell<
                  item[myStr] = myRec;
                  //end for
                  for(var myStr in item){
                  getDisp_lv[myStr] = item[myStr]; //<<maybe here I need to build in a "&" or "=" ?
                  //end while
                  getDisp_lv.sendAndLoad("update_AllTables_gb.asp", recDisp_lv, "POST");

                  Thank you,

                  • 6. Re: LoadVars / POST
                    luciewong Level 1
                    Wow, this is getting an issue. The 3rd day today.

                    Retrieve Data ( column names + data values ) from a Grid, assign it to a LoadVars, and send it back to the Server, using "POST".

                    "GET" works, but "POST" not.
                    But I need to use POST, because I need to send large amount of data.

                    I think, the issue could be the String, LoadVars sends.
                    The String looks like this:
                    strOrder=DESC&logPW=user&logUI=x&logDB=testBdb&direct%5FD1=xxx&sponsor21=xxx&i1%5Fagencyno =xxxx&sb%5Fagencyno=TF58M&i1%5Fseatno=MA878&agentFamname=GREEN&agentFirstname=MARK&payment %5Fdate1=5%2F8%2F2003& > and so on.

                    This String above "GET" probably can read, but not "POST".
                    So I would like to convert the String to:
                    strOrder=DESC&logPW=user&logUI=x&logDB=testBdb&direct_D=xxx&sponsor2=xxx&i1_agencyno=xxxx& sb_agencyno=TF58M&i1_seatno=MA878&agentFamname=GREEN&agentFirstname=MARK&payment_date=5/8/ 2003& > and so on.

                    I tried many things, LV.decode, unescape , but nothing works, the String is always Url-encoded.
                    Maybe I am totally on the wrong track, but ….
                    Somebody could give me a hint?

                    • 7. LoadVars / POST
                      Greg Dove Level 4
                      Both POST and GET are sent urlencoded. So that part is working correctly.If the only difference in actionscript is that you changed GET (which worked for to transferring smaller amounts of records) to POST then your actionscript side should be fine.

                      What is likely is that you are not correctly accessing the equivalent POST variable in your server script. I don't use ASP - so I can't advise what to do there from personal experience.

                      • 8. Re: LoadVars / POST
                        Greg Dove Level 4
                        According to this, just using the Request('variablename') in ASP should work for POST data. But it won't if there was a GET variable with the same name.


                        It might be safest to access your POST variables through the

                        • 9. Re: LoadVars / POST
                          luciewong Level 1
                          Thank you GWD,
                          Yes, I think you are right. Something in my ASP must be wrong.

                          The problem is this.
                          When you update a Table, usually you know the Table name and you know the column names.
                          But, as I retrieved the data, I told ASP > "write out all columns + all data you have in your table"<
                          This was easy, I just say:

                          strSQL1 = "SELECT * FROM ["& requestTable & "]"

                          //then …
                          Do While x < noColumns
                          Response.write "cName" & x & "=" & rs.Fields(x).name &"&" //<writes all Column names

                          The same I did with the data, I don't wonna write all my ASP code here, but the important part tells ASP, now write all data you have in your columns>

                          Response.write((Field.name) & recsNo) & "=" & Field.value &"&"

                          So, got all columns - got all data - put all together in a Grid, works fine.
                          But now the way back, I want to update.
                          Still I don't really know the column names, so I can't write them in the ASP hardcoded.
                          So I say:

                          x=1 //<columns except 0/AutoField

                          noC = rs.Fields.count //<columns
                          y = rs.RecordCount //<records

                          While c < y
                          Do While x < noColumns
                          itemF = rs.Fields(x).name //<<now this assigns all column names to the var itemF

                          then I say>
                          rs.Fields(x).Value = request(itemF & c) //<<the problem is here<*see comment below
                          x = x+1
                          x = 1
                          c = c+1

                          *The problem is here: As "itemF" is a var created by ASP itself, it is not really a Request.

                          A usual request would like this in ASP:
                          rs("compA_array") = request("compA_array")

                          //You can see the difference. If I would write >itemF< in quotes like it should be
                          rs.Fields(x).Value = request("itemF" & c)
                          <then this does not work, because itemF is a var created in ASP and not a requested column name.
                          But coming closer, now I am quite sure, that its not a Flash issue, I must find a better way to write my request.
                          Thank you for your help. Will go on searching.
                          • 10. Re: LoadVars / POST
                            luciewong Level 1
                            5th. day today - very depressed - still > GET works and POST not!
                            I put an >onHTTPStatus func today on the LV and it writes out: Http Error 500/ Server Error /
                            I tried local and online.
                            Still GET works and POST not. Same code in Flash + ASP.
                            What can it be??????? Is it a security issue????
                            Thank you for your help.