Welcome to Abdul Malik Ikhsan's Blog

Zend Framework 2 : Using Zend\Form and Ajax

Posted in Tutorial PHP, Zend Framework 2 by samsonasik on October 11, 2012

Ajax can make our life easier. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. It can create our web more interactive. In this post, i will show you how to use Zend\Form with ajax. I used jQuery javascript library.

I will give you an example how to show modal dialog that contain form, like this :

We see the link “Show Form” in index page that if we trigger click, we will show the dialog form.

1. Download jQueryUI, you can download from jQueryUI Website
2. Open Downloaded jQueryUI like the following :

3. copy external, ui, and themes to our public folder. ( I assumed you already installed the Skeleton Application which already include jQuery Javascript library), like the following :


1. create a module with structure like the following :

2. create Entity ( I assumed we use form annotation builder )

namespace TestAjax\Model;

use Zend\Form\Annotation;

 * @Annotation\Hydrator("Zend\Stdlib\Hydrator\ObjectProperty")
 * @Annotation\Name("TestEntity")
class TestEntity
     * @Annotation\Type("Zend\Form\Element\Text")
     * @Annotation\Required({"required":"true" })
     * @Annotation\Filter({"name":"StripTags"})
     * @Annotation\Filter({"name":"StringToUpper"})
     * @Annotation\Validator({"name":"StringLength", "options":{"min":"5"}})
     * @Annotation\Options({"label":"Input Your Name:"})
    public $name;
     * @Annotation\Type("Zend\Form\Element\Submit")
     * @Annotation\Attributes({"value":"Submit"})
    public $submit;

3. create a Controller

namespace TestAjax\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\Form\Annotation\AnnotationBuilder;
use TestAjax\Model\TestEntity;

class SkeletonController extends AbstractActionController
    public function indexAction()
        return array();
    protected function getForm()
        $builder    = new AnnotationBuilder();
        $entity     = new TestEntity();
        $form       = $builder->createForm($entity);
        return $form;
    public function savetodb($data)
        //code save to db ....
    public function showformAction()
        $viewmodel = new ViewModel();
        $form       = $this->getForm();
        $request = $this->getRequest();
        //disable layout if request by Ajax
        $is_xmlhttprequest = 1;
        if ( ! $request->isXmlHttpRequest()){
            //if NOT using Ajax
            $is_xmlhttprequest = 0;
            if ($request->isPost()){
                if ($form->isValid()){
                    //save to db 😉
                    'form' => $form,
                    // is_xmlhttprequest is needed for check this form is in modal dialog or not
                    // in view
                    'is_xmlhttprequest' => $is_xmlhttprequest 
        return $viewmodel;
    public function validatepostajaxAction()
        $form    = $this->getForm();
        $request = $this->getRequest();
        $response = $this->getResponse();
        $messages = array();
        if ($request->isPost()){
            if ( ! $form->isValid()) {
                $errors = $form->getMessages();
                foreach($errors as $key=>$row)
                    if (!empty($row) && $key != 'submit') {
                        foreach($row as $keyer => $rower)
                            //save error(s) per-element that
                            //needed by Javascript
                            $messages[$key][] = $rower;    
            if (!empty($messages)){        
            } else {
                //save to db 😉
        return $response;

4. create a file named ajaxform.js in public/js folder with code like the following :

            modal: true,
            autoOpen: false,
            resizable: false,
            title:'Form Ajax',
        return false;

5. include the ajaxform.js in index.phtml file :

<!-- css -->
<!-- the custom UI is based on jQueryUI theme you've downloaded -->
<?php $this->headLink()
            ->prependStylesheet($this->basePath() . '/js/jqueryUI/themes/custom_ui/jquery-ui-1.8.24.custom.css'); ?>
<!-- Js -->            
<?php  $this->headScript()
            ->appendFile($this->basePath() . '/js/jqueryUI/ui/jquery-ui-1.8.24.custom.js') 
            ->appendFile($this->basePath() . '/js/ajaxform.js'); ?>

<a id="showform" href="<?php echo $this->url('TestAjax/default',
                    array('action'=>'showform', 'controller'=>'skeleton')); ?>">Show Form</a>
<!-- empty div to save dialog temporary -->
<div id="winpopup"></div>

6. create a ajaxform-up.js in public/js folder :

        //if not call by ajax
        //submit to showformAction
        if (is_xmlhttprequest == 0) 
            return true;
        //if by ajax
        //check by ajax : validatepostajaxAction
               { 'name' : $('input[name=name]').val() }, function(itemJson){
                var error = false;
                if (itemJson.name != undefined){
                    if ($(".element_name ul").length == 0){
                        //prepare ...
                    for(var i=0;i<itemJson.name.length;i++)
                       if ($(".element_name ul").html().substr(itemJson.name[i]) == '')
                            $(".element_name ul").append('<li>'+itemJson.name[i]+'</li>');
                    error = true;
                if (!error){
                    if (itemJson.success == 1){
                        alert('Data saved');   
        }, 'json');
        return false;

7. include the ajaxform-up.js in showform.phtml file :

<script type="text/javascript">
    var is_xmlhttprequest = <?php echo $this->is_xmlhttprequest; ?>;
    var urlform           = '<?php echo $this->url('TestAjax/default', array('controller'=>'skeleton', 'action'=>'validatepostajax')); ?>';

<?php echo $this->headScript()->appendFile($this->basePath() . '/js/ajaxform-up.js'); ?>

$title = 'Add Test';
<h1><?php echo $this->escapeHtml($title); ?></h1>

$form = $this->form;
$form->setAttribute('action', $this->url(
        'action'     => 'showform',
        'controller' => 'skeleton'

<?php echo $this->form()->openTag($form); ?>
<div class="element element_name">
    <?php echo $this->formRow($form->get('name')); ?>
<div class="element element_submit">
    <?php echo $this->formRow($form->get('submit')); ?>
<?php echo $this->form()->closeTag(); ?>

Btw, I just uploaded source to github. You can grab this example’s sourcecode from this : https://github.com/samsonasik/TestAjax

Done !

References :
1. http://en.wikipedia.org/wiki/Ajax_%28programming%29

104 Responses

Subscribe to comments with RSS.

  1. Li said, on October 17, 2012 at 6:50 am

    Other excellent tutorial, thank you so much.

  2. samsonasik said, on October 17, 2012 at 2:47 pm

    You’re welcome 😉

  3. houssemzaier said, on October 26, 2012 at 5:21 am

    Thanks for all this precious information 🙂
    I need a tutorial ” crud ” made for the doctrine can u please help us with managing this .
    It will be really helpful my friend , thanks in advance

  4. samsonasik said, on October 26, 2012 at 12:49 pm

    You’re welcome. For doctrine 2 in ZF2, i think this tutorial http://www.jasongrimes.org/2012/01/using-doctrine-2-in-zend-framework-2/ will really helpful.

    • houssemzaier said, on October 26, 2012 at 9:12 pm

      THANKS AGAIN brother 🙂
      it’s an old tutorial that need update , you can look at this line
      // class AlbumController extends ActionController
      this tutorial was done with old classes and it’s since 2 June 2012:.
      if you can find an other solution please reply me again because I fed up 😦
      I need to understand doctrine integration with ZF2
      for conclusion: let me say you are awesome I’ll check your blog every week for learning more and more .
      thx samsonasik 🙂

      • samsonasik said, on October 26, 2012 at 9:51 pm

        change ActionController with AbstractActionController , i hope i can blog about that soon

      • houssemzaier said, on October 27, 2012 at 3:05 am

        Yes sir !

  5. dimuthu said, on November 6, 2012 at 4:46 pm

    how can we save data to the DB

  6. Beto Lima said, on November 7, 2012 at 2:07 am

    Hi man, thanks for sharing your codes.
    But i can’t do render this example. i don’t know what to do.
    Follow this errors:

    A 404 error occurred
    Page not found.
    The requested controller could not be mapped to an existing controller class.

    Skeleton(resolves to invalid controller class or alias: Skeleton)

  7. samsonasik said, on November 7, 2012 at 12:43 pm

    check your module.config.php route. btw, you can grab the code from my github account : https://github.com/samsonasik/TestAjax

  8. Beto Lima said, on November 7, 2012 at 7:40 pm

    but i did download from your TestAjax of github.
    So, in the line 20 of module.config file we have ‘controller’ => ‘Skeleton’,
    Then i change to ‘controller’ => ‘TestAjax\Controller\Skeleton’,
    But when i click the link “show form” it opens a popup but end up getting another error in my firebug:
    GET http://curso-zf2:8081/testajax/skeleton/showform 404 (Not Found)

    • samsonasik said, on November 8, 2012 at 2:34 am

      1. what zf2 version you’re using ? if you’re using < zf2.0.3 , you should upgrade first.
      2. you shouldn't change the config, just grab the module, place at module/vendor folder, copy asset in public folder to your public directory, register the module at config/application.config.php ( maybe you forgot this step to reg your module ) and run it.

  9. Beto Lima said, on November 8, 2012 at 2:50 am

    I have version 2.0.3. so I went back the code as before: ‘controller’ => ‘Skeleton’.
    Still the error persists.
    In my aplication I put config yes ‘TestAjax’ module.

    • samsonasik said, on November 8, 2012 at 12:51 pm

      it’s weird. it’s work for me even i update to the latest 2.0.4 dev, or downgrade to 2.0.2, or 2.0.3. maybe, you have a clash route ? have you try to change the rename skeleton controller to other ? can i look your module.config.php ?

  10. Beto Lima said, on November 8, 2012 at 6:13 pm

    of corse, follow below:

  11. samsonasik said, on November 9, 2012 at 9:38 am

    I think, for your case, you should add

    'defaults' => array(
        'action' => 'showform'

    in your child_routes.

    • Beto Lima said, on November 9, 2012 at 5:30 pm

      ok guy, thanks for help. now i can finally.
      Please take a look the file modified below:
      i had that change the controller called again to: ‘controller’ => ‘TestAjax\Controller\Skeleton’
      Thanks so much.

  12. Nicolas said, on November 30, 2012 at 7:50 pm

    Hello, I downloaded your codes but in my browser I only see errors :-S
    There is 2 warnings saying “Failed opening ‘init_autoloader.php'”.
    And finaly this error : “Fatal error: Class ‘Zend\Mvc\Application’ not found in C:\wamp\www\TestAjax-master\public\index.php on line 15”
    Can you help me ? (please)

  13. Nicolas said, on November 30, 2012 at 9:58 pm

    Thanks. But… It stiil doesn’t work.
    The new skeleton doesn’t work (it can’t find the ZF2_path in the init_autoloader when he checks the ‘Zend\Loader\AutoloaderFactory’).
    So I tried with an older skeleton. The link to show the form is visible but when I click on it :
    “Fatal error: Class ‘Doctrine\Common\Annotations\AnnotationRegistry’ not found in C:\wamp\www\TestAjax-master\vendor\zendframework\zendframework\library\Zend\Code\Annotation\Parser\DoctrineAnnotationParser.php on line 46”

  14. Pierre said, on December 13, 2012 at 8:45 pm

    It would be really helpful to front-end developers who don’t want to use composer (which you can’t run on shared hosts), don’t want to use annotations, and don’t need Doctrine or get into installing any ORM at that stage, to have a lightweight version of this tutorial focusing on using AJAX, ajaxform and ZF2 with let’s say the simple TableGateway from the docs. Thanks in advance.

    • samsonasik said, on December 14, 2012 at 11:25 am

      build form using doctrine annotion is just an alternative, you can build it ‘manually’ by extends Zend\Form\Form. You’re welcome. Thanks for the suggestion.

  15. Leo said, on February 2, 2013 at 11:16 am

    What’s this ? Class ‘Doctrine\Common\Annotations\AnnotationRegistry’ not found. Thank you.

  16. Wow, that’s what I was searching for, what a data! existing here at this webpage, thanks admin of this website.

  17. Dobre Mihai (@dobreraj) said, on February 18, 2013 at 9:27 pm


    Nice work! Can you make some tutorials witj ZF and dojo, too?

    Thank you!

  18. Mohammad Nomaan said, on April 19, 2013 at 12:43 pm


    I am trying this login with ajax. But problem is that I am not getting how to call authentication action along with validatepostajax Action. On click submit button it is calling just validatepostajax Action. Please help


  19. samsonasik said, on April 19, 2013 at 7:13 pm

    debug your js, try using firebug or something similar 😉

  20. Mohammad Nomaan said, on April 19, 2013 at 7:53 pm

    Hi thanks for your reply!!!

    I have debug the js but in reponse it is return the whole html script instead of username and password….

    • Mohammad Nomaan said, on April 19, 2013 at 8:00 pm

      here is my js code

      $.post(“auth/authenticate”,{ user_name:$(‘input[name=username]’).val(),password:$(‘input[name=password]’).val()} ,function(data)
      if(data==’yes’) //if correct login detail
      $(“#msgbox”).fadeTo(200,0.1,function() //start fading the messagebox
      //add message and change the class of the box and start fading
      $(this).html(‘Logging in…..’).addClass(‘messageboxok’).fadeTo(900,1,
      //redirect to secure page

      $(“#msgbox”).fadeTo(200,0.1,function() //start fading the messagebox
      //add message and change the class of the box and start fading
      $(this).html(‘Your login detail sucks…’).addClass(‘messageboxerror’).fadeTo(900,1);


      return false;

  21. Fayçal said, on July 9, 2013 at 5:08 am

    Salam alikoum Mr samsonasik

    first of all i want to thank you for all the tutorials that you are sharing with us , they are very helpful

    here is my problem i want to get a json response from one of my controller’s action am geting the data from mysql with

    $data = $this->getEntityManager()->getRepository(‘Company\Entity\ShareHolders’)->findAll()

    when i try to retunr it with a jsonModel

    return new JsonModel(“data”=>$data)

    i got the expected number of rows but empty

    here is the firbug display


    any advice on what am doing wrong

    sorry for my english

    thank you

  22. Muhammad Amjad said, on July 9, 2013 at 2:22 pm

    Salam Brother
    I learn alot of things from your website because your way of explaining is very simple and good but i don’t know
    how to create cascading dropdown list using ajax and jquery in zf2 plz explain a little because i am new in zf2 here is a demo:


  23. Isolde said, on August 4, 2013 at 4:22 pm

    Hi, another great tutorial, thank you!
    I have one problem, it works fine but my show form doesn’t open in a popup but rather replaces the index.php. I noticed 2 things: I added an “alert(“Hi”); to ajaxform.js and it does not show this alert as if it never gets this ajaxform.js. If I go to the controller and comment out the following:
    if ( ! $request->isXmlHttpRequest()){ …}
    it suddenly shows my alert Hi on reloading the index.phtml page (so it can find it allright) but the show form still replaces my index.phtml instead of opening in a popup.
    Also, my alert is at the beginning of the ajaxform.js, the other two alerts within the function are never called. It seems it can find it but the function is never called. Am I missing something?
    Thank you for your time and great tutorials!

    • samsonasik said, on August 4, 2013 at 6:48 pm

      clone my source from my github account https://github.com/samsonasik/TestAjax

      • Isolde said, on August 4, 2013 at 9:53 pm

        Hi Samsonasik,
        I did that, I am using your code from github now but I get the same problem: the show form never opens in a pop-up but rather replaces the index… 😦
        I get “ReferenceError: $ is not defined
        ajaxform-up.js” but I’m not sure if that has anything to do with it. It doesn’t work in any of my browsers so it isn’t a browser issue either. It just won’t poppup… 😦

      • Isolde said, on August 4, 2013 at 10:19 pm

        Okay, I found out why it wouldn’t work, I threw out my jquery.min.js (version 1.9.0) and replaced it with your version from your source at github (jquery-1.7.5.min.js) and it worked! So my jquery version was too new… 🙂 Thank you again for your good tutorials!

      • samsonasik said, on August 4, 2013 at 10:46 pm

        you’re welcome 😉

  24. Sajid Ali said, on August 27, 2013 at 7:44 pm

    following error is coming please help
    Fatal error: Class ‘Doctrine\Common\Annotations\AnnotationRegistry’ not found in D:\wwwroot\app\vendor\zendframework\zendframework\library\Zend\Code\Annotation\Parser\DoctrineAnnotationParser.php on line 42

  25. Lex Luther said, on September 4, 2013 at 10:16 am

    Hi Samsonnasik, I’m newbie in Zend 2.
    I did exactly eveything you guided but i still have error.
    “No element by the name of [name] found in form ”
    Can you help me why get this error? thanks you very much!

    • samsonasik said, on September 4, 2013 at 10:30 am

      it indicate you typo in the element name you write between view and the form creation

  26. Ragunathan said, on September 26, 2013 at 7:20 pm

    Can You Give me the database table format of test form..because i am new in ajax ..

  27. Simbu said, on October 3, 2013 at 12:12 pm

    hello sir,

    I have ajax.php file???? when I put in my view folder and coded few script in my add.phtml,but it not works

    without framework when i put ajax.php and add.html,it works fine,,,,

  28. […] working within Zend Framework 2 and following this tutorial to display and handle form submission via AJAX. Instead of using a jQuery UI modal, I’m using […]

  29. […] working within Zend Framework 2 and following this tutorial to display and handle form submission via AJAX. Instead of using a jQuery UI modal, I’m using […]

  30. chirag said, on November 11, 2013 at 8:42 pm

    “Fatal error: Class ‘Doctrine\Common\Annotations\AnnotationRegistry’ not found in C:\wamp\www\TestAjax-master\vendor\zendframework\zendframework\library\Zend\Code\Annotation\Parser\DoctrineAnnotationParser.php on line 46″ i used windows but i cant solved it.

  31. nilesh pawar said, on November 12, 2013 at 1:42 pm

    how to make a popup on click in ZF2

  32. chirag said, on November 12, 2013 at 2:02 pm

    @Samsonasik Thanks for your reply .

    follow link https://samsonasik.wordpress.com/2012/10/04/zend-framework-2-step-by-step-build-form-using-annotation-builder/ .
    added doctrine/common to vendor\zendframework\zendframework\composer.json .
    but last step COMPOSER_PROCESS_TIMEOUT=5000 php composer.phar install but its gives error like this: ‘COMPOSER_PROCESS_TIMEOUT’ is not recognized as internal or external command.

    so please help me to solve above issue.
    Thanks in advance.

  33. chirag said, on November 12, 2013 at 7:44 pm

    Thanks for replay this help me :

    Form annotations require Doctrine\Common, which contains an annotation parsering engine. The simplest way to install Doctrine\Common is if you are using Composer; simply update your composer.json and add the following line to the require section:

    “doctrine/common”: “>=2.1”,
    Then run php composer.phar update to install the dependency.

    If you’re not using Composer, visit the Doctrine project website for more details on installation.

  34. chirag said, on November 18, 2013 at 1:22 pm

    I dont want to popup in my code so as per your demo code call showform action direct by localhost/ajax_demo/public/testajax/skeleton/showform . while submit this form its call validatepostajax function two time means validate two times and also save data into database two times.

    Please help me how to prevent it for submit and validate only one time.

    Thanks in Advance..

  35. chirag said, on November 18, 2013 at 1:27 pm

    When i call showform action direct without popup and submit form so its rediect on same page so works without ajax so for prevent to reload comment code

    if (is_xmlhttprequest == 0)
    return true;
    in ajaxform-up.js.

  36. Nico Nico said, on December 17, 2013 at 4:53 am

    I dont know if you will be able to help me but i dont know why my validation dont work, it’s always ok !
    I create a post, can you watch it ? Thanks for your support !


  37. nilesh said, on December 20, 2013 at 2:20 pm

    how to add same form with dynamic data dynamically in zf2

  38. nilesh said, on December 20, 2013 at 2:22 pm

    formRow($form->get(‘faqQues’)); ?>

    formRow($form->get(‘faqAns’)); ?>

    I want above two forms multiple times with dynamic data coming from DB

  39. Oleg Abrazhaev said, on February 6, 2014 at 11:01 am

    Thank you. I’m just searching for this

    //disable layout if request by Ajax

  40. Khoa said, on March 7, 2014 at 9:36 am

    Thank you for your post. You can help me how to use ajax beyon file index.phtml, if i write code in another page i can’t call ajax,


  41. jasne said, on May 20, 2014 at 2:15 pm

    when I open showform action I get an error: “Fatal error: Uncaught exception ‘Zend\Form\Exception\InvalidElementException’ with message ‘No element by the name of [name] found in form’ in C:\xampp2\htdocs\vendor\zendframework\zendframework\library\Zend\Form\Fieldset.php:223 Stack”…

    would you tell me what is going on ?

    • samsonasik said, on May 21, 2014 at 4:03 am

      It is my old post, I’m not sure if it fully working right now. have you tried extending Zend\Form\Form or using ‘forms’ config to create form ? if no, you need to try it, there is no one way to do something 🙂

      • jasne said, on May 22, 2014 at 5:29 pm

        I’ve just discovered that problem appear only when is Zend Developer Tools module on.
        Why ?

      • samsonasik said, on May 22, 2014 at 6:00 pm

        debug it, please do effort

  42. Jose said, on June 27, 2014 at 7:02 pm

    Hi samsonasik. thanks alot for your tutotial are very useful.

    I have a problem with the modal dialog, almost works well but when I press the button to show the form in a dialog the button redirect me to the showform in a normal page not in a modal dialog

    when I press the button the page turn off the light as a properly works but finally goes to showform with a nomal form.

    sorry for my english.

    thank you very much in advance

  43. Mohammed Nej said, on June 30, 2014 at 7:53 am

    Hello .. thnx for the tuto
    i have a problem please help me
    i follow your instruction but when i clik in show form it not show me the popup window but it redirects me to another page normal not modal popup
    thnx for reply

    • samsonasik said, on July 1, 2014 at 11:57 pm

      it seems your javascript is not working, see the error using firebug console

  44. david said, on July 10, 2014 at 7:20 pm

    An error occurred
    An error occurred during execution; please try again later.
    Additional information:




    Route with name “TestAjax” not found

    found this problem when configured application plz let me help out bcoz m newbie in zf2

    thanks in advance

  45. Youssef said, on February 9, 2015 at 7:57 pm

    thanks for this very usefull tutorial but i have a question :
    if i try to do this modal not with controller not with ajax ; just with html css jquery, i can do this !!?

    best regards ..

    • samsonasik said, on February 10, 2015 at 4:45 am

      yes, but that’s mean nothing todo with ZF :p, just code it, place modal div in you view, and call it like the jqueryUI documentation in modal section said 😉

  46. Nikita said, on February 17, 2015 at 7:24 pm

    Hi, Can this be done without ORM doctrine and using tablegateway instead?

    • samsonasik said, on February 17, 2015 at 11:28 pm

      I only use doctrine/common, not related with ORM anymore 😛

  47. ellipee said, on February 24, 2015 at 10:24 pm

    Hello, Thank you for this great tutorial, i applied your tutorial to my update button, but the problem i having is that only the first update button in my album list pop up the ajax update form, the rest when clicked will load normal update page. please help me out.

    • samsonasik said, on February 25, 2015 at 12:45 am

      you need to debug that. try firebug or something similar.

  48. Reny said, on March 18, 2015 at 7:53 pm

    Hello, I used the module. But I got an error Fatal error: Class ‘Doctrine\Common\Annotations\AnnotationRegistry’ not found in /var/www/html/zendframework/vendor/zendframework/zendframework/library/Zend/Code/Annotation/Parser/DoctrineAnnotationParser.php on line 42

  49. Reny said, on March 19, 2015 at 12:02 pm

    Hi, I have been gone through the link earlier. I have done upto step 3rd. Is 4th step necessary ?

    • samsonasik said, on March 20, 2015 at 1:22 am

      current post is jqueryUI specific, so yes, try it if it works, and debug it

  50. Chandan Sharma said, on January 19, 2016 at 4:33 pm

    Hello sir,

    I am getting this error when I run application. Please help me resolve it.

    Fatal error: Uncaught Error: Class ‘Doctrine\Common\Annotations\AnnotationRegistry’ not found in D:\xampp\htdocs\loginform\vendor\zendframework\zend-code\src\Annotation\Parser\DoctrineAnnotationParser.php:42 Stack trace: #0 D:\xampp\htdocs\loginform\vendor\zendframework\zend-form\src\Annotation\AnnotationBuilder.php(423): Zend\Code\Annotation\Parser\DoctrineAnnotationParser->__construct() #1 D:\xampp\htdocs\loginform\vendor\zendframework\zend-form\src\Annotation\AnnotationBuilder.php(107): Zend\Form\Annotation\AnnotationBuilder->getAnnotationParser() #2 D:\xampp\htdocs\loginform\vendor\zendframework\zend-form\src\Annotation\AnnotationBuilder.php(165): Zend\Form\Annotation\AnnotationBuilder->setAnnotationManager(Object(Zend\Code\Annotation\AnnotationManager)) #3 D:\xampp\htdocs\loginform\vendor\zendframework\zend-form\src\Annotation\AnnotationBuilder.php(208): Zend\Form\Annotation\AnnotationBuilder->getAnnotationManager() #4 D:\xampp\htdocs\loginform\vendor\zendframework\zend-form\src\Annotation\AnnotationBuilder.php(244): in D:\xampp\htdocs\loginform\vendor\zendframework\zend-code\src\Annotation\Parser\DoctrineAnnotationParser.php on line 42

  51. Alexander Sidorov said, on February 6, 2018 at 8:39 pm

    Which database are you using? Tables, fields?

  52. alexsidorov1972 said, on February 7, 2018 at 1:24 am

    I am sorry, I am new in ZF2.
    My current ZF2 version is 2.4.13.
    After clicking on the link I got the error:

    Fatal error: Class ‘Doctrine\Common\Annotations\AnnotationRegistry’ not found in C:\wamp\www\TestAjax\vendor\zendframework\zendframework\library\Zend\Code\Annotation\Parser\DoctrineAnnotationParser.php on line 42

    Can you help me?

    • alexsidorov1972 said, on February 7, 2018 at 1:52 am

      Oh, sorry, I missed the posts above. I installed the doctrine, but the form is showing without popup

    • samsonasik said, on February 7, 2018 at 1:52 am

      you need to install “doctrine/annotations”. I suggest to learn ZF3 instead if you’re on learning. Learn step by step from the documentation https://docs.zendframework.com/tutorials/

    • alexsidorov1972 said, on February 7, 2018 at 2:05 am

      I’ve installed “doctrine/common” : “>=2.1”,
      The error is not showing, but popup is missing. The jqueryui version I am using is 1.8.24

      • alexsidorov1972 said, on February 7, 2018 at 2:24 am

        In my jqueryUI build there are no the files ajaxform.js, ajaxform-up.js, html5.js.
        Where did you get?

      • samsonasik said, on February 9, 2018 at 9:54 pm

        Please read step by step carefully, slowly, also, check my last paragraph at the post, I uploaded the sample at github.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: