util::html::get_forms (public)
util::html::get_forms -html html
Defined in packages/acs-tcl/tcl/html-procs.tcl
Extract every form's specification from HTML supplied
- Switches:
- -html (required)
- HTML text
- Returns:
- Form specification as a nested list of lists in array get form
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: # Parse document dom parse -html -keepEmpties -- $html doc set root [$doc documentElement] set forms [list] # Get every form... foreach f [$root selectNodes {//form}] { set form [list "attributes" [util::get_node_attributes -node $f]] set fields [list] # ...every input tag foreach input [$f selectNodes {//input}] { lappend fields [list tag "input" attributes [util::get_node_attributes -node $input]] } # ...every select tag with its options foreach select [$f selectNodes {//select}] { set field [list tag "select" attributes [util::get_node_attributes -node $select]] set options [list] foreach option [$f selectNodes {option}] { lappend options [list attributes [$option attributes] value [$option nodeValue]] } lappend field options $options lappend fields $field } # ...and every textarea foreach textarea [$f selectNodes {//textarea}] { set field [list tag "textarea" attributes [util::get_node_attributes -node $textarea]] lappend field value [$option nodeValue] lappend fields $field } lappend form "fields" $fields lappend forms $form } return $formsXQL Not present: Generic, PostgreSQL, Oracle