mam ogromny problem z sprawdzaniem ajaxowym formularza.
Ale od początku.
Mam sobie layout:
ta akcja $this->action('newsletter', 'Offers') odwołuje się do kontrolera Offers i akcji newslleter która zawiera:
public function newsletterAction(){ $form = new Form_Newsletter(); $form->setAction($this->view->url()); if ($this->getRequest()->isXmlHttpRequest() && $this->getRequest()->isPost()){ $response = $form->processAjax($this->getRequest()->getPost()); if($response == 'true'){ $formData = $form->getValues(); // tu jakaś akcja }else{ exit; } } $this->view->newsletterForm = $form; }
i wywołując tę akcję mam zwrotkę w postaci:
Kod
<html>
<head>
<title>test</title>
</head>
<body id="home" xml:lang="pl">
<div>
{"email":{"isEmpty":"Value is required and can't be empty","stringLengthTooShort":"'' is less than 6 characters long","emailAddressInvalidFormat":"'' is no valid email address in the basic format local-part@hostname"}}
<head>
<title>test</title>
</head>
<body id="home" xml:lang="pl">
<div>
{"email":{"isEmpty":"Value is required and can't be empty","stringLengthTooShort":"'' is less than 6 characters long","emailAddressInvalidFormat":"'' is no valid email address in the basic format local-part@hostname"}}
i jest prawie dobrze, prawie gdyż nad zwrotką jsonową mam kod html, moje pytanie brzmi: zwrócić jedynie:
{"email":{"isEmpty":"Value is required and can't be empty","stringLengthTooShort":"'' is less than 6 characters long","emailAddressInvalidFormat":"'' is no valid email address in the basic format local-part@hostname"}}
