Example #1
0
 public static function fromDom($dom)
 {
     $input = new Scrapt_Component_Input();
     $input->setValue($dom->value);
     $input->setName($dom->name);
     if (isset($dom->type)) {
         $input->setType($dom->type);
     } else {
         // How do I get an element type?
         $input->setType($dom->tag);
     }
     return $input;
 }
Example #2
0
 public static function fromDom($dom_form, $onURL = null)
 {
     if (!$dom_form instanceof simple_html_dom_node) {
         var_dump($dom_form);
         exit;
     }
     $f = $dom_form;
     $form = new Scrapt_Component_Form();
     $form->setName($f->name);
     $form->setMethod($f->method);
     $form->setAction($f->action);
     $form->setPageURL($onURL);
     // Find inputs.
     $inputs = $f->find('select,input,textarea');
     foreach ($inputs as $i) {
         $form->addInput(Scrapt_Component_Input::fromDom($i));
     }
     return $form;
 }