AW Form Service

AW Form service usage note:

fields_config:

In this module all forms fileds are declared.
To add new form add the config subarray inside the form_topics array
Form config array contains:

  • atts
    • update_service
      • This service is use to handle the form data after submit
      • More details explained bellow
    • callback_service
      • This service is optional, it used for do the specific activities after the form submission
    • Also you can pass the form specific parameters using atts eg. admin mail etc.
  • groups
    • In this field mention the all form groups with label as the group label
    • In the group declare all the form fields this fields will come from the form_control2 service

Sample:

 
update_service

  • Mention the service slug which will handle the form submission
  • In this service do the server side validation and return the array if any error occured.
    • To make server side validation works return the validation array with key as validations in which subarray contains key as meta_key and reason as error msg.
  • You can use any content type service or collection service to handle the form submission eg: candidate, admission, lead

 

Ticket:

  • This module is used to generate the redis ticket which is used in form handling.
  • To generate the ticket use this:

  •  

Single Submit:

  • This module receives the ajax request from form submit handler
  • The all request params array is then set in the single_data env variable
  • The form_config of that form type is also set in the single_data variable
  • The form name is also set in the single_data varable
  • Then update service is fired which is mentioned in the single_data’s form_config variable
  • Then update service Fired
  • If update service gives validation error then these errors are returned as the javascript code which will show the error msg in the forms fields.
  • It also populates the first error form control field.
  • If any callback service is mentioned in  the form_config then that service fired after the execution  of the update service.
  • If every thing  is fine then final success msg is returned.

 

validation

  • This module contents all the validation templates.
  • Depends on the data_type of the filed, particular form validation ran.
  • If the validation get failed then error msg returned with the validation error and field key.

 

Form Control2

  • All the form fields which are mentioned in the form config gets the html from the form control2 service

Create

Call this module with the slug parameter of form which needs to be created.
To change the layout of the form fields just change the form_layout parameter.
usage:

 
 

Updated on Sep 16, 2019