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
<?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
<form method="post" 
action="<?php echo $this->action('helloWorld_function')?>">
    <input type="text" name="name" value="" /> 
    <input type="submit" value="Sumbit" />
</form>
<h1><?php echo $myName; ?></h1>

siton
 
mnakalay replied on at Permalink Reply
mnakalay
To use the form helper you can first look at this page:
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...
siton replied on at Permalink Reply
siton
How to do the idea of "action()" with the form helper?
"action="<?php echo $this->action('helloWorld_function')?>">"
mnakalay replied on at Permalink Reply
mnakalay
the action is not related to the form helper, it is related to the page's controller
mnakalay replied on at Permalink Reply
mnakalay
Also, you might want to sanitize user inputs, for security reasons:
http://documentation.concrete5.org/developers/security/sanitizing-u...