<p>I am a Craft newbie, and I'm currently making a few custom templates, learning Twig, etc.<br>
My question is: in including a form in my template code, how would the form be coded (Twig or HTML)?  Is there a good tutorial/reference on forms used in this way?  Also, how would I reference my php code (which is within my plugin)?  </p>

<p>The form will be an log-in authentication, and the plugin contains the code to verify that the user exists in Active Directory (LDAP).  </p>

<p>I'll sketch out the way my website is laid out.  There are only a handful of users who actually log in to CraftCMS in order to make changes to content on the website.<br>
However, the login form I'm making here is not to log in to Craft, but to gain access to one page of the website.  I will need to create a form page template and have it submit to my php code (plugin) somehow.   </p>

CC BY-SA 4.0
2018-06-14T21:30:07.693Z
I highly recommend taking a look to the contact form plugin from Pixel and Tonic -> https://github.com/craftcms/contact-form/tree/v1 for Craft2 (Craft3 is in the V2 branch)

Check how they add hidden values in the `Usage` section of the readme file. You can follow the code in the controller folder. Best!
Andre L.
CC BY-SA 4.0
2018-06-18T21:45:30.800Z
Thanks - I've checked it out.  Just out of curiosity, where in the controller do 'action' and 'redirect' values appear?  I saw them (hidden) in the form code, but cannot in the processor.  Thanks
buck1112
CC BY-SA 4.0
2018-06-19T16:49:04.450Z
I've added some clarification in my question (above) in the last paragraph, re: purpose of login form and website structure.
buck1112
<plugin-development><templating><form>
Form in Front End Template Reference Plugin for LDAP
# Form in Front End Template Reference Plugin for LDAP

(Asked by: username_0 on 2018-06-14)

I am a Craft newbie, and I'm currently making a few custom templates, learning Twig, etc.  
My question is: in including a form in my template code, how would the form be coded (Twig or HTML)? Is there a good tutorial/reference on forms used in this way? Also, how would I reference my php code (which is within my plugin)?

The form will be an log-in authentication, and the plugin contains the code to verify that the user exists in Active Directory (LDAP).

I'll sketch out the way my website is laid out. There are only a handful of users who actually log in to CraftCMS in order to make changes to content on the website.  
However, the login form I'm making here is not to log in to Craft, but to gain access to one page of the website. I will need to create a form page template and have it submit to my php code (plugin) somehow.

**Tags:** plugin-development, templating, form

> **Comments:**
> **username_1**: I highly recommend taking a look to the contact form plugin from Pixel and Tonic -> https://github.com/craftcms/contact-form/tree/v1 for Craft2 (Craft3 is in the V2 branch)  Check how they add hidden values in the `Usage` section of the readme file. You can follow the code in the controller folder. Best!  
> **username_0**: Thanks - I've checked it out.  Just out of curiosity, where in the controller do 'action' and 'redirect' values appear?  I saw them (hidden) in the form code, but cannot in the processor.  Thanks  
> **username_0**: I've added some clarification in my question (above) in the last paragraph, re: purpose of login form and website structure.  

---

## 0 answers

