<!---
In this example, we will create a form that helps users add new widgets
to the 7o database.
We will use three tags:
- postform (encloses the form users will fill out)
- input (contains user-defined or preset data that will be sent in the postform)
- postsuccess (displays success message when user submits widget)
--->
<!--- Here's the postform (requires an end tag): --->
<postform>
<!--- this just gives the form a title --->
<h1>Add a New Widget:</h1>
<postsuccess>
<!--- if the user has just added a widget, they will see this message. --->
<h3>Widget added! Good job.</b></h3>
</postsuccess>
<!--- this lets the user pick a title for the widget: --->
<b>Title:</b> <input type="text" name="1_title"><br><br>
<!--- notice that the input is named '1_title'. this tells the database that we
want to update the title field, and that this is part of the same record as
other inputs that begin with '1_'. --->
<!--- this lets the user describe the widget by giving it a subtitle: --->
<b>Subtitle:</b> <input type="text" name="1_subtitle"><br><br>
<!--- the name of the field is '1_subtitle'. this tells the database that we want
to update the subtitle field, and also that this is still part of the same
record as the '1_title' field. if both fields start with '1_', the database
will recognize that they are part of the same form group. --->
<!--- This gives the user a "submit" button --->
<input type="submit" value="Insert Widget">
<!--- Important! We need to have a few hidden form fields that tell the database what we want to do. --->
<input type="hidden" name="1_posttype" value="INSERT">
<!--- this means: "form fields beginning with '1_' are part
of a NEW record we are INSERTing into the database --->
<input type="hidden" name="1_orb" value="widget">
<!--- this means we are adding a *widget* and not another type of record. --->
</postform>
<hr>
<!--- this isn't part of the form; it simply shows that the form works. --->
<br><h3>Here are the last seven widgets you added:</h3>
<set orb="widget" select="widget.id, widget.title, widget.subtitle" where="widget.user_id = #client_id#" orderby="widget.id DESC" maxrows="7"><!--- client_id is always the logged in user's id number --->
<setcrawl>
<b>#set.title#</b> | #set.subtitle#<br><br>
</setcrawl>
<setempty>
(just kidding, you didn't add any)
</setempty>
</set>