March 16

LAA Framework - add a form

Create form html, and give a form name (which will be handled by controller when form is submitted)

        <form class="new-form" method="post" action="">
          <input type="hidden" name="form_name" value="my_form_name">

          <!-- form contents -->
          <div class="form-group">
            <label>Airway Bill Nubmer:</label>
            <input required="" id="shelf_number" type="text" name="Pallets[airwaybill_number]" value="">

          <input type="submit" class="btn btn-primary" value="save">

Add form handler to Controller Action section:


Create a form handler and validation for this form based on form_name in controller: 

   function form_add_palletFormValidate() {
     // check $this->post for any error for the user input data
      $this->messages['form_error'][]='eorror message if any'; // add error to arry if any. If no error is added, FormSubmit will take over.

function form_add_palletFormSubmit() {
    // handle your post data...
    ..... php code to handle submit with domain+model
    // on successful submission, add message and redirect the page back to user.    
    MessageHelper::add('Save successfully.');
    LAA::redirect(); // reload the form page.

Send us a message. We will reply as soon as we can.