External Forms for 5.7

Permalink
Hi all,

I am trying to learn how to implement custom forms in my sites and as someone who is quite inexperienced with PHP, I was hoping someone could share a basic, working, email contact external form that I can work through, customise and try to gain a better understanding of what is happening.

I have tried using the sample external form however I never seem to get anywhere, I seem to learn better by picking apart something that workings, seeing what breaks it and working from there.

Any help would be greatly appreciated.

Richard

 
linuxoid replied on at Permalink Reply
linuxoid
Do you want to write your own form package or you just need a contact form on your site?

Have a look at this package FYI:https://www.concrete5.org/marketplace/addons/loginlogout-link...
mobius2000 replied on at Permalink Reply
Hi Linuxoid,

Thanks for the suggestion... I am in fact trying to make up some custom contact forms with jquery step plugin (wizard type forms) and some other forms that have calculation functions in it.

I know how to achieve this in straight HTML however implementing it into Concrete5 5.7 is confusing me so I think the external forms block is my best option but I can't seem to get my head around creating it.

Although a great suggestion, I don't think this is what I am after.
linuxoid replied on at Permalink Reply
linuxoid
I do recommend you have a look at the Login package. To me, it's one of the simplest blocks to start with, while the External Form is totally useless and confusing.

I felt the same with C5 and MVC some time ago too. So, what helped me was to realize the following basic stuff (in non-programmer language):

1. the view.php file has the presentation code - how it will show in a browser
2. the controller.php has the form processing and other code - it takes data from view.php, does something with it and outputs other data back to view.php

For, example:
view.php
<?php echo $form->label("name", $entry_name, array ('class'=>"required")); ?>
<?php echo $form->text('name', $name, array ('maxlength'=>"40"")); ?>

See the two variable $entry_name and $name? Now, the controller:
controller.php
use \Concrete\Core\Block\BlockController;
class Controller extends BlockController {
    public $name = '';
    public $entry_name = 'Name:';
    ...
    public function view() {
        $this->set('entry_name', $this->entry_name);
   if (isset($this->name)) {
      $this->set('name', $this->name);
   } else {
      $this->set('name', '');
   }
        ...
    }


You can style your block with a view.css and have JS code in a view.js in the same block folder together with your view.php and controller.php files.

Now you can take it from here...

PS. Also have a look at these:
www.www.youtube.com/watch?v=uGacIeYzIpI...
https://www.concrete5.org/documentation/how-tos/developers/concrete5...
https://www.concrete5.org/documentation/developers/5.6/system/packag...
PixelFields replied on at Permalink Reply
PixelFields
Hi Linuxoid,

Did you have any success with your custom forms? I'm trying to do something similar and also came to the conclusion that an External Form block was the place to start but not finding a lot of documentation for it.

Thanks,
Laila, Pixel Fields