-
Notifications
You must be signed in to change notification settings - Fork 4
HTML Form Handling
Sudheer edited this page Mar 11, 2023
·
8 revisions
Set of functions to manage a HTML form that is submitted by the client (typically a browser) Deals with form fields
The form object is acquired in the server code in the following method
local request = platform.get_http_request();
local form = request:parse_req_form();
Examines if the given HTML form is empty
Parameters:
form: userdata, HTML form handle
Return:
flg: boolean, true if empty, false otherwise
ERROR:
Exceptions are thrown upon error, which can be caught via mechanism of pcall/xpcall
Begins iterating through the list of form fiels
Parameters:
form: userdata, HTML form handle
Return:
name: string, field name, nil if there are no fields
value: string, nil if there are no fields
ERROR:
Exceptions are thrown upon error, which can be caught via mechanism of pcall/xpcall
Gets the next form field
Parameters:
form: userdata, HTML form handle
Return:
name: string, field name, nil if there are no more fields
value: string, nil if there are no more fields
ERROR:
Exceptions are thrown upon error, which can be caught via mechanism of pcall/xpcall
Retrieves the value of a form field
Parameters:
form: userdata, HTML form handle
field_name: string, form field name
Return:
value: string
ERROR:
Exceptions are thrown upon error, which can be caught via mechanism of pcall/xpcall