Esempio n. 1
0
 public static function with_errors(Formlet $other)
 {
     return $other->mapHTML(V::fn(function ($dict, $html) {
         $name = self::html_get_depth_first_name($html);
         if ($name === null) {
             throw new Exception("_with_errors applied to un-named Formlet.");
         }
         $errors = $dict->errors($name);
         if ($errors === null) {
             return $html;
         }
         foreach ($errors as $error) {
             $html = H::concat($html, H::tag("span", array("class" => "error"), H::text($error)));
         }
         return $html;
     }));
 }