EOF; $doc = phpQuery::newDocumentHTML($form); $inputs = $doc['form > *']; // creates array from input names // $results = $inputs->get(null, // create_function('$node', 'return $node->getAttribute("name");') // ); $results = array(); foreach($inputs as $node) { $node = pq($node); $name = $node->attr('name'); $results[$name] = false; $node->change( new CallbackReference($results[$name]) ); } $inputs ->not('select,:checkbox,:radio') ->val('new value') ->end() ->filter('select') ->val('first') ->end() ->filter(':checkbox') ->val(array('foo')) ->end() ->filter(':radio') ->val(array('foo')) ->end() ; foreach($results as $name => $result) { print $result ? "Test for '$name' PASSED :)
\n" : "Test for '$name' FAILED !!!
\n"; }