Pages

Pages

Previous: Step 3: Adding Permissions Up to Contents Next: Creating a custom success page

How to build submission forms using Xataface

Jump:

A submission form (a form for users to submit information into a database) is a very common use-case for Xataface. This tutorial teaches you how to do it the right way.

Step 4: Adding instructions

Submission forms generally have some instructions at the top of the page to tell the user what the form is for, etc..

To add instructions to the form, we will just need to insert some content into the before_new_record_form block (defined in the Dataface_New_Record.html template).  If you are new to the concept of blocks, slots, and templates, please take a moment to read the customization section of the Getting Started tutorial.

We add the following to our table's delegate class to fill in some instructions in this block:

function block__before_new_record_form(){
echo <<<END

<h1>FAS Open House Guest Registration Form</h1>
<p>To register as our guest at Discover Applied Sciences, simply fill in the blanks below.</p>
<p>Pre-registration earns you TWO entries into the Grand Prize Draw (iPods!). </p>
<p>Those joining us without pre-registering are most welcome and will be
given one entry into the Grand Prize Draw. </p>
END;

This little method will cause the instructions to show up just above our new record form as follows:


Previous: Step 3: Adding Permissions Up to Contents Next: Creating a custom success page
blog comments powered by Disqus
Powered by Xataface
(c) 2005-2025 All rights reserved