Problems posting with urlencode

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joseph Chase

    #1

    Problems posting with urlencode

    I have the following form :


    <form action="/auction/create/" method="post">< p><label
    for="auction_cr eated">Created</label><br /></p>
    <p><label for="auction_us er">User</label><br /><input id="auction_use r"
    name="auction[user]" size="30" type="text" value="" /></p>
    <p><label for="auction_au ction_title">Au ction title</label><br /><input
    id="auction_auc tion_title" name="auction[auction_title]" size="30"
    type="text" value="" /></p>
    <p><label for="auction_au ction_url">Auct ion url</label><br /><input
    id="auction_auc tion_url" name="auction[auction_url]" size="30" type="text"
    value="" /></p>
    <p><label for="auction_mo dification_rec" >Modification rec</label><br
    /><input id="auction_mod ification_rec" name="auction[modification_re c]"
    size="30" type="text" value="" /></p>
    <p><label for="auction_st ate">State</label><br /><input id="auction_sta te"
    name="auction[state]" size="30" type="text" value="" /></p><input
    name="commit" type="submit" value="Create" /></form>


    I post the form data with the following calls:

    params = urllib.urlencod e({"auction[user]" :user,
    "auction[auction_title]": auction_title," auction[auction_url]": auction_url,
    "auction[modification_re c]" :recommendation , "auction[state]=":
    state,"commit": "Create"})

    print "Storing... ."
    data = urllib.urlopen( self.baseUrl,pa rams)


    When I go and view the inserted record, the record exists, but the field
    values are null. It is my thinking that the backend needs the "id" value
    for each input value; how do I add that data to the urlencode() call?

    When I utilize the above form, all is inserted and all of the field values
    appear. What data am I not accounting for with my program; for its obvious
    that the browser is sending something to the server that my application is
    not.

    Thanks.


  • Fredrik Lundh

    #2
    Re: Problems posting with urlencode

    Joseph Chase wrote:
    [color=blue]
    > When I go and view the inserted record, the record exists, but the field
    > values are null. It is my thinking that the backend needs the "id" value
    > for each input value; how do I add that data to the urlencode() call?[/color]

    since the id isn't part of the form data set:



    that's a bit unlikely.

    printing the params string might help you figure out what's
    missing.

    </F>



    Comment

    • Steve Holden

      #3
      Re: Problems posting with urlencode

      Fredrik Lundh wrote:[color=blue]
      > Joseph Chase wrote:
      >
      >[color=green]
      >>When I go and view the inserted record, the record exists, but the field
      >>values are null. It is my thinking that the backend needs the "id" value
      >>for each input value; how do I add that data to the urlencode() call?[/color]
      >
      >
      > since the id isn't part of the form data set:
      >
      > http://www.w3.org/TR/REC-html40/inte...#form-data-set
      >
      > that's a bit unlikely.
      >
      > printing the params string might help you figure out what's
      > missing.
      >[/color]

      If there's no chance of putting any debug statements into the processing
      script you might consider using a proxy or submitting to a local server
      to ensure that you are submitting what you think.

      regards
      Steve
      --
      Steve Holden +44 150 684 7255 +1 800 494 3119
      Holden Web LLC www.holdenweb.com
      PyCon TX 2006 www.python.org/pycon/

      Comment

      Working...