Getting form field value

$form:field_name

Such a construction returns value of form field. Returned object may belong either to class
file, if field type is file, or class string.Further actions with object can be performed only by methods prescribed for relevant classes.

Field bearing no name is referred to as
nameless.
Coordinates sent by browser when a visitor clicks image with attribute ISMAP can be accessed through
$form:imap.

You should remember that if <input type="image" name="fieldname" /> is used in html and visitor click on this image, the browser will send coordinates of this action in
fieldname.x č fieldname.y fields.


Example: text field, image field and file uploading
^if(def $form:photo){
   ^form:photo
.save[binary;/upload/photos/beauty.^file:justext[$form:photo.name]]
   
Image $form:photo.name was uploaded.
}
^if(def $form:user){
   User$form:user<br />
}
^if(def $form:[action.x]){
   Coordinates:<br />
   X: 
$form:[action.x]
<br />
   
Y$form:[action.y]
<br />
}
<form method="post" enctype="multipart/form-data">
<input type="file" name="photo">
<input type="text" name="user">
<input type="image" name="action" src="/i/button.gif" width="75" height="25" />
</form>

…will store picture uploaded to server by a visitor through form field in specified file.


Example: nameless field
<img src="/show.html?123&a=b" />

Within
show.html string 123 can be accessed as $form:nameless.




Copyright © 1997–2021 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 07.12.2008