Form helper - and single pages - send & receive data
Permalink
In this simple example i set name and the single page print "hello name".
Example:
I set in the form the name to "ezra" --> sumbit
The output: "Hello ezra"
"THE PROBLEM" This example works fine but i want to learn how to use the form helper to pass data (not html markup). What i need to change in the view code?
The controller:
single_page/controllers/example.php
The view:
single_page/example.php
Example:
I set in the form the name to "ezra" --> sumbit
The output: "Hello ezra"
"THE PROBLEM" This example works fine but i want to learn how to use the form helper to pass data (not html markup). What i need to change in the view code?
The controller:
single_page/controllers/example.php
<?php //Controller namespace Application\Controller\SinglePage; use PageController; class Example extends PageController { public function helloWorld_function(){ $name = "Hello " . $this->post('name'); $this->set('myName', $name); } }
The view:
single_page/example.php
How to do the idea of "action()" with the form helper?
"action="<?php echo $this->action('helloWorld_function')?>">"
"action="<?php echo $this->action('helloWorld_function')?>">"
the action is not related to the form helper, it is related to the page's controller
Also, you might want to sanitize user inputs, for security reasons:
http://documentation.concrete5.org/developers/security/sanitizing-u...
http://documentation.concrete5.org/developers/security/sanitizing-u...
http://documentation.concrete5.org/developers/appendix/form-widget-...
It shows you how to use the helper and some specific form widgets (font picker, user picker, color picker...)
TO learn about the more traditional form inputs (text input, select list, checkbox...) you can look at the legacy docs. It hasn't changed with 5.7
http://legacy-documentation.concrete5.org/developers/forms/standard...