PHP code example of naucon / form-bundle

1. Go to this page and download the library: Download naucon/form-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

naucon / form-bundle example snippets


    
    // app/AppKernel.php

    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Naucon\Bundle\FormBundle\NauconFormBundle(),
        );
    }

    class DefaultController extends Controller
    {
        public function newAction(Request $request)
        {
            $user = new User();

            $formFactory = $this->get('naucon_form.factory');

            $form = $formFactory->createForm($user, 'user');
            if ($form->isBound()
                && $form->isValid()) {
                // some action, like saving the data to database

                // redirect to success page
            }

            return $this->render('default/new.html.twig', array(
                'form' => $form
            ));
        }
    }

 {{ ncform_start(form, method='post', action='some-action', enctype='some type', {furtherOptions:'option'}) }}
 {{ ncform_field(form, 'text', 'activation_code', { style: 'some style', id: 'some id', value: 'some value', maxlength: 'some lenght', class: 'css class',