Appearance
Tutorial: Idea Box
Build a simple "Idea Box" application where anyone can submit ideas and see them displayed on the page. This tutorial covers creating a table, building a form, configuring a submission pipeline, and displaying data with a repeater.
What You Will Build
- A form where visitors submit ideas (content + author name).
- A list of all submitted ideas, newest first.
- An action pipeline that validates, timestamps, and saves each idea.
Step 1: Create a New App
- Go to WP-Nexus > Apps in your WordPress admin.
- Click Create App.
- Name it
Idea Box. - Click Save.
Step 2: Create the Ideas Table
- In your Idea Box app, go to the Tables tab.
- Click Add Table.
- Name the table
ideas. - Add these columns:
| Column Name | Type | Description |
|---|---|---|
content | text | The idea text |
author_name | varchar(255) | Who submitted it |
created_at | datetime | When it was submitted |
- Click Save Table.
TIP
The id column is created automatically as an auto-incrementing primary key. You do not need to add it.
Step 3: Create a Component
- Go to the Components tab.
- Click Add Component.
- Name it
Idea Box Page. - You are now in the visual UI builder.
Step 4: Build the Submission Form
Add these widgets to the canvas:
- Heading -- Text:
Share Your Idea. - Form Container -- This wraps the form fields.
Inside the Form Container, add:
- Textarea -- Name:
content, Label:Your Idea, Required:true. - Text Input -- Name:
author_name, Label:Your Name, Required:true. - Submit Button -- Text:
Submit Idea.
Your widget tree should look like:
Heading ("Share Your Idea")
Form Container
├── Textarea (name: "content")
├── Text Input (name: "author_name")
└── Submit Button ("Submit Idea")Step 5: Configure the onSubmit Pipeline
Select the Form Container widget and open the Actions panel. Click Configure onSubmit to open the pipeline builder.
Add these nodes and connect them in order:
Node 1: Context
This is the entry point. It collects the form field values (content, author_name).
Node 2: Set Field
Set the created_at timestamp:
fieldName: "created_at"
expression: "now()"Node 3: Validate
Add these validation rules:
json
[
{ "field": "content", "rule": "required" },
{ "field": "content", "rule": "min_length", "value": "5" },
{ "field": "author_name", "rule": "required" },
{ "field": "author_name", "rule": "min_length", "value": "2" }
]Node 4: Save Row
tableId: (your ideas table ID)Node 5: Output
Connect Save Row to Output. This returns the saved row to the frontend.
Final pipeline:
Context → Set Field (created_at) → Validate → Save Row → OutputTIP
If validation fails, the pipeline stops at the Validate node and returns error messages. The form automatically displays them next to the relevant fields.
Step 6: Display Ideas with a Repeater
Below the form, add a Divider widget for visual separation, then add a Heading with text Recent Ideas.
Next, add a Repeater widget. Configure its data source:
Data Source Pipeline
Add a Table Query node:
tableId: (your ideas table ID) orderBy: "created_at" order: "DESC" limit: 50Add a Result node and connect it.
Table Query → ResultRepeater Template
Inside the Repeater, add:
- Card container with these children:
- Text -- Content:
{ {row.content}} - Container (flex, row, justifyContent: space-between)
- Text -- Content:
By { {row.author_name}}, font size:14px, color:#666 - Text -- Content:
{ {date_format(row.created_at, 'M j, Y g:i A')}}, font size:14px, color:#999
- Text -- Content:
- Text -- Content:
Step 7: Style the Components
Card styling
padding: 16px
borderWidth: 1px
borderColor: #e0e0e0
borderRadius: 8px
margin: 0 0 12px 0
backgroundColor: #ffffffIdea text
fontSize: 16px
color: #333
margin: 0 0 8px 0Step 8: Add a Shortcode
- Save your component.
- Go to the Components tab.
- Copy the shortcode shown for the
Idea Box Pagecomponent (e.g.,[wp_nexus app="idea_box" component="idea_box_page"]). - Paste it into any WordPress page or post.
TIP
Slugs use underscores, not hyphens. The shortcode attributes must match the exact slugs defined in WP-Nexus (e.g., idea_box, not idea-box).
Step 9: Test It
- Visit the page with the shortcode.
- Fill in an idea and your name.
- Click Submit Idea.
- The form should clear and the new idea should appear at the top of the list.
- Try submitting with empty fields to see validation errors.
What You Learned
- Creating a custom database table with WP-Nexus.
- Building a form with Form Container, inputs, and a Submit Button.
- Configuring an action pipeline: Context, Set Field, Validate, Save Row, Output.
- Displaying data with a Repeater and Table Query data source.
- Using expressions like
{ {row.content}}and{ {date_format(...)}}in widgets.
Next Steps
- Add a Rate Limit node to prevent spam.
- Add a Sanitize node to clean input.
- Add a delete button per idea (see Delete Row).
- Require login to submit ideas (see Require Auth).