Re: Re: HTML_DataObjects_Edit/Browse

From: Date: Tue, 11 May 2004 12:43:46 +0000
Subject: Re: Re: HTML_DataObjects_Edit/Browse
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12420@lists.php.net to get a copy of this message
Thats pretty borked.. :) - I think I marked setErrors in Flexy_Element as a bad mistake... I just modified the code in HTML_DataObjects_Edit to set {errors[.....]} http://devel.akbkhome.com/svn/index.php/akpear/HTML_DataObject/DataObject/Edit.php ** note the subversion server has moved slightly.. below is the css/html I use for error messages alot - shows a really nice box at the top in red - indicating the problems. - It has the added benefit of putting the error messages into the HTML - so they can be translated.. I you want to return specific error messages from validate* in the dataobject - try returning array('tolong'] => true ) and use flexy:if="errors[birthday][toolong]" Regards Alan tablewarning{
        border-color : #FFFFFF #000000 #000000;
        border : 0px none;
        border-collapse : collapse;
        padding : 0px;
        MARGIN: 15px;
} .tdheaderwarning {
        color : #FFFFFF;
        FONT-FAMILY: arial,geneva,helvetica,sans-serif;
        font-size : 14px;
        font-weight : bold;
        padding-bottom : 0px;
        padding-left : 0px;
        padding-right : 0px;
        padding-top : 0px;
        text-align : center;
        vertical-align : middle;
        background-color: #cc3333;
} .tdbodywarning {
        border-bottom-width : 1px;
        border-color : #000000 #333333 #333333;
        border-left-width : 1px;
        border-right-width : 1px;
        border-style : dashed;
        border-top-width : 0px;
        padding-left : 15px;
        padding-right : 15px;
        padding-top : 15px;
        padding-bottom : 15px;
        background-color: #eecccc;
        FONT-FAMILY: arial,geneva,helvetica,sans-serif;
        font-size : 10px;
        COLOR: #000000;
} <table flexy:if="errors" class="tablewarning"> <tbody>
    <tr>
      <td class="tdheaderwarning" height="20">Sorry</td>
    </tr>
    <tr>
      <td class="tdbodywarning">
        <p flexy:if="errors[somefield]">There was a problem with your name</p>
      <p flexy:if="errors[birthday]">Please fill in correct birthday</p>
      </td>
    </tr>
</tbody> </table> Nohuman wrote:
Thanks Alan!
try {t:r} - it should show you where the errors are stored.
The error msg is in t.elements.<html_flexy_element>->suffix value, but this is not accesible in template. I haked the ../HTML/Template/Flexy/Element.php, and work fine like QuickForms Regards ------------------------------------------------------------------ function toHtml($overlay=false)
    {
                 //echo "BEFORE<PRE>";print_R($this);
        $ret = $this;
        if ($overlay !== false) {
            $ret = HTML_Template_Flexy::mergeElement($this,$overlay);
        }
                if ($ret->override !== false) {
            return $ret->override;
        }
        $prefix = $ret->prefix;
        if (is_object($prefix)) {
            $prefix = $prefix->toHtml();
        }
        $suffix = $ret->suffix;
        if (is_object($suffix)) {
            $suffix = $suffix->toHtml();
        }
        //echo "AFTER<PRE>";print_R($ret);
        // tags that never should have closers          //////////////////////////////////////////////////////////////////
        if($this->suffix)                                              ///             print '<font class="error">'.$this->suffix.'</font><br>';  ///         /////////////////////////////////////////////////////////////////            $tag = $this->tag;
        if (strpos($tag,':') !==  false) {
            $bits = explode(':',$tag);
            $tag = $bits[1];
        }
        $close = in_array(strtoupper($tag),array("INPUT","IMG")) ? '' : "</{$ret->tag}>{$suffix}" ;
        return "{$prefix}<{$ret->tag}".$ret->attributesToHTML() . '>'.
$ret->childrenToHTML() .$close;
                     } // end func toHtml
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.general (#12420) next »