Form fields: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
m moved Form field to Form fields: typo
imported>Bale
No edit summary
Line 9: Line 9:


function1={{Function|
function1={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type=string|
return_also={{#var:return_also}}|
parameter1={{Param|string|value}}|
p1desc=Returns the {{Pspan|value}} attribute of a previously-submitted input tag.|
}}|
function2={{Function|
name={{#var:name}}|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
aggregate={{#var:aggregate}}|
Line 23: Line 14:
return_also={{#var:return_also}}|
return_also={{#var:return_also}}|
parameter1=|
parameter1=|
p1desc=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,
p1desc=Similiar to [[form_field|form_field()]], but returns 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.|
and can distinguish a field with a blank value from a nonexistent field.|
}}|
}}|
Line 37: Line 28:
</syntaxhighlight>}}|
</syntaxhighlight>}}|


see_also={{SeeAlso|write|writeln}}|
see_also={{SeeAlso|form_field|write|writeln}}|
}}
}}

Revision as of 09:35, 3 May 2010

Function Syntax

string [string] form_fields()

  • Similiar to form_field(), but returns 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

form_field() | write() | writeln()