Re: post leaves out form variables with empty values
Martin Simmons <[email protected]> Fri, 25 Jun 2004 14:22:21 +0100
| Newsgroups | gmane.lisp.cl-http |
|---|---|
| Message-ID | <[email protected]> |
>>>>> On Thu, 24 Jun 2004 23:47:24 -0400, Mark Klein <[email protected]> said: Mark> I traced a problem in my server to the following fact: As the example Mark> below will show, if you create a fillout-form which gets some Mark> strings, and the user leaves some fields blank when filling it out, Mark> the query-alist passed to the response function *leaves out* the Mark> variables for which no values were entered, as opposed for example to Mark> including the variables with null strings as their value. Mark> (defmethod show-form ((url url:http-form) stream) Mark> (http:with-successful-response (stream :html) Mark> (html:with-fillout-form (:post url :stream stream) Mark> (html:accept-input 'html:string "v1" :stream stream) Mark> (html:accept-input 'html:string "v2" :stream stream) Mark> (html:accept-input 'html:submit-button "Submit" :stream stream)))) Mark> (defmethod get-form ((url url:http-form) stream query-alist) Mark> (http:with-successful-response (stream :html) Mark> (write query-alist :stream stream))) Mark> (http:export-url #u"/test.html" Mark> :html-computed-form Mark> :form-function #'show-form Mark> :response-function #'get-form) Mark> I understand that makes the POST a little smaller, but for my Mark> purposes I want all the form variables to appear in the query-alist. Mark> How can this be done? It looks CL-HTTP's form decoding code in HTTP::PARSE-FORM-RAW-VALUES is written that way. You can work around it like this, but I'm not sure if that is by design: (html:with-fillout-form (:post url :stream stream :ENCODING-TYPE '(:MULTIPART :FORM-DATA)) ...) __Martin