acs::test::xpath::get_form_values (public)
acs::test::xpath::get_form_values node xpath
Defined in packages/acs-automated-testing/tcl/aa-test-procs.tcl
Obtain form values (input fields and textareas) in form of a dict (attribute value pairs). The provided XPath expression must point to the HTML form containing the values to be extracted.
- Parameters:
- node (required)
- xpath (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- create_folder_with_page, create_form_with_form_instance
Source code: set values {} foreach n [$node selectNodes $xpath//input] { set name [get_name_attribute $n $xpath//input] if {$name eq ""} continue # Disabled attributes are not sent together with the form # on submit, so we do not fetch them. if {[$n hasAttribute disabled]} { continue } # Do not consider unchecked radio buttons or checkboxes as # values if {[$n getAttribute type ""] in {"radio" "checkbox"} && ![$n hasAttribute checked]} { continue } #ns_log notice "aa_xpath::get_form_values from $className input node $n name $name:" if {[$n hasAttribute value]} { set value [$n getAttribute value] } else { set value "" } lappend values $name $value } foreach n [$node selectNodes $xpath//textarea] { set name [get_name_attribute $n $xpath//textarea] if {$name eq ""} continue # Disabled attributes are not sent together with the form # on submit, so we do not fetch them. if {[$n hasAttribute disabled]} { continue } #ns_log notice "aa_xpath::get_form_values from $className textarea node $n name $name:" set value [$n text] lappend values $name $value } foreach n [$node selectNodes $xpath//select/option\[@selected='selected'\]] { set name [get_name_attribute [$n parentNode] $xpath//option/..] if {$name eq ""} continue # Disabled attributes are not sent together with the form # on submit, so we do not fetch them. if {[$n hasAttribute disabled]} { continue } set value [$n getAttribute value] lappend values $name $value } return $valuesXQL Not present: Generic, PostgreSQL, Oracle