Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:entwickler:index:forms [2025/03/09 11:17] fasseen:entwickler:index:forms [2025/03/09 11:18] (current) fasse
Line 1: Line 1:
 ====== Forms - Create, validate and save ====== ====== Forms - Create, validate and save ======
-==== Introduction ====+===== Introduction =====
 With version 5, the handling of forms has been improved. Forms can be created in PP with a separate form class from Admidio and a Smarty template. The form sends its entries to the server via an Ajax call and receives a response. This can be an error message if the data was not entered correctly or a success message if the form data could be saved. The data is validated automatically based on the information from the form order. With version 5, the handling of forms has been improved. Forms can be created in PP with a separate form class from Admidio and a Smarty template. The form sends its entries to the server via an Ajax call and receives a response. This can be an error message if the data was not entered correctly or a success message if the form data could be saved. The data is validated automatically based on the information from the form order.
  
-==== Creating an HTML form ====+===== Creating an HTML form =====
 The first step is to create a page with the **PagePresenter** class. The first step is to create a page with the **PagePresenter** class.
 <code php>$page = PagePresenter::withHtmlIDAndHeadline('adm_example_page', $gL10n->get('SYS_EXAMPLES'));</code> <code php>$page = PagePresenter::withHtmlIDAndHeadline('adm_example_page', $gL10n->get('SYS_EXAMPLES'));</code>
Line 74: Line 74:
 Other design elements such as Bootstrap **cards** or notes can be stored directly in the template and do not have to be defined via the **Forms** class as in earlier versions. Other design elements such as Bootstrap **cards** or notes can be stored directly in the template and do not have to be defined via the **Forms** class as in earlier versions.
  
-==== Validate and save form data ====+===== Validate and save form data =====
 Once the form has been created, the script for processing the form must now be adapted. The first step is to validate the form content. You can use the following code for this. Once the form has been created, the script for processing the form must now be adapted. The first step is to validate the form content. You can use the following code for this.
 <code php>$exampleEditForm = $gCurrentSession->getFormObject($_POST['adm_csrf_token']); <code php>$exampleEditForm = $gCurrentSession->getFormObject($_POST['adm_csrf_token']);
  • en/entwickler/index/forms.txt
  • Last modified: 2025/03/09 11:18
  • by fasse