Form fields: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
Created page with '{{ #vardefine:name|form_fields}}{{ #vardefine:return_type|string [string]}}{{ #vardefine:aggregate|yes}}{{ FunctionPage| name={{#var:name}}| function_category=Relay Browser Func…'
 
imported>Bale
m moved Form field to Form fields: typo
(No difference)

Revision as of 09:32, 3 May 2010

Function Syntax

string form_fields(string value )

  • Returns the value attribute of a previously-submitted input tag.

string [string] form_fields()

  • As above, but returns as a map with all the name/value pairs from the relay request being handled. Unlike the previous form_field() function, this allows iterating over all the fields, and can distinguish a field with a blank value from a nonexistent field.

Used to read form information in User Interface Scripts.

Code Sample

Read the form fields in a UI script for use later.

string [string] fields;
fields = form_fields();
boolean success = count(fields) > 0;

See Also

write() | writeln()