|
req.data Object storing HTTP form and environment data as named properties. Syntax
Here we see all three methods of setting a key-value pair: res.write('<form action=" + root.href("showValues") + " method="post"><input name="city"><input type="submit"></form>'); res.write('<form action=" + root.href("showValues") + " method="get"><input name="district"><input type="submit"></form>'); res.setCookie("street", "Lindengasse"); File root/showValues.hac: res.write(req.data.city); res.write(req.data.district); res.write(req.data.street); Note: If you have got a cookie and a form element with the same name sent by "get" or "post", the cookie value will be overridden by the form value.
... comment
kmfdm,
Wednesday, 5. June 2002, 18:14
File-Uploads
Fileuploads generate a MimePart-Object. This object has a simple method for writing it's content to a file: .writeToFile(pathstring, filename)
For example: <form action=... method=post enctype="multipart/form-data"> <input type=file name=upload>------- This get's submited to the following hac-file, which just saves this image. ------- req.data.upload.writeToFile("/tmp", "testfile.dat"); ... link ... comment
nex,
Monday, 17. February 2003, 14:25
Re: req.data
at the moment the document above says:
The function get() provides exactly the same functionality in a what we think not as comfortable way (gotta type brackets and quotes). But it's just a matter of taste which one to use.This is wrong. While the object.propertyName syntax requires you to specify the name of a property when you write your code, the get() syntax not only allows a string literal to specify the name of the property, but also a string variable, i.e. with the latter you can get a proper whose name you don't know yet. This is very useful, for example if you extend hopobject with a macro that displays an arbitrary property whose name is given as a parameter of the macro. In this case, you must use the get function, that's not a matter of taste. Please correct!
... link
tobi,
Saturday, 22. February 2003, 13:36
Re: Re: req.data
you can do this with req.data, too:
req.data[variableName] so i think the text is just ok. it remains a question of taste which function to use, even though with a variable as property name you have to type brackets in both cases. ... link
nex,
Friday, 21. March 2003, 11:11
oh, sorry
I should wear sackcloth and ashes until I learned how ECMAScript works; didn't know that the notation with the brackets is equivalent. If you want to remove my silly comment and add a hint at the req.data[name] form to the manual, you have my blessing :-)
... link ... comment |
navigation
Download
Community
Weblog
Mailing Lists
IRC Channel
Documentation
Introductions
Tools
Reference
Project
Roadmap
Bug Reporting
Source
Wiki
Tags
Updates
Related Projects
search
|
||||