views:

50

answers:

2

Error decorator input errors such way:

  <ul class="error">
     <li>Error message</li>
 </ul>

How can i remove this tags and leave only error message text?

A: 
$doc = new DOMDocument();

$doc->loadHTML('url');

$xPath = new DOMXpath($doc);
$xPathQuery = "//text()[contains(translate(.,'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'), '".strtoupper('error message')."')]";
$elements = $xPath->query($xPathQuery);


 print " .$element->nodeValue."<br />";
Jordy
A: 
$errors = $zendForm->getErrorMessages();

I think this should work? Not 100% sure though I don't have time to check documentation.

Richard Knop