| title | Tutorial - Building Your First Application | ||||||
|---|---|---|---|---|---|---|---|
| description | Step-by-step guide to building a personal information form application with validation and dynamic displays | ||||||
| category | Learning | ||||||
| version | 1.0.0 | ||||||
| last_updated | 2026-04-10 | ||||||
| audience | beginner, learner | ||||||
| time_estimate | 30-45 minutes | ||||||
| prerequisites |
|
||||||
| tags |
|
This comprehensive tutorial will guide you through creating a simple but complete application using PromptBasic IDE. We'll build a "Personal Information Form" that collects user data and displays it dynamically.
By the end of this tutorial, you'll have created an application that:
- Collects user information through form inputs
- Displays the information dynamically
- Includes interactive buttons and feedback
- Demonstrates various UI controls and natural language programming
Estimated Time: 30-45 minutes
- Completed the Getting Started guide
- PromptBasic IDE running at http://localhost:3000
- Basic understanding of UI concepts (optional)
Before we start coding, let's plan what we're building:
Application Name: Personal Info Collector
Features:
- Text input for name
- Dropdown for age group
- Radio buttons for gender
- Checkbox for newsletter subscription
- Button to submit and display information
- Display area for submitted information
- Clear button to reset the form
UI Layout:
[Name: _______________]
[Age Group: ▼]
○ Male ○ Female ○ Other
☐ Subscribe to newsletter
[Submit] [Clear]
--- Submitted Information ---
Name: [display]
Age Group: [display]
Gender: [display]
Newsletter: [display]
-
Start with a clean slate: If you have any existing controls, clear them by refreshing the page or starting a new project.
-
Add a Label for the title:
- Drag a "Label" from the toolbox onto the form
- Position it at the top center
- Double-click it and set the text to "Personal Information Form"
-
Add Name input:
- Drag a "TextBox" onto the form
- Position it below the title
- Add a "Label" next to it with text "Name:"
-
Add Age Group dropdown:
- Drag a "ComboBox" (dropdown) onto the form
- Add a "Label" with text "Age Group:"
- We'll configure the options later
-
Add Gender radio buttons:
- Drag three "RadioButton" controls
- Arrange them horizontally
- Label them "Male", "Female", "Other"
- Group them by setting the same GroupName property
-
Add Newsletter checkbox:
- Drag a "CheckBox" control
- Label it "Subscribe to newsletter"
-
Add action buttons:
- Drag two "Button" controls
- Label them "Submit" and "Clear"
-
Add display area:
- Drag several "Label" controls for displaying results
- Group them in a "Results" section
- Initially set their text to empty or placeholder text
Use the visual designer to arrange your controls in a logical flow:
- Title at the top
- Form inputs in the middle
- Buttons at the bottom
- Results display at the bottom
Double-click the Age Group ComboBox and set its properties:
Items: Under 18,18-24,25-34,35-44,45-54,55-64,65+
SelectedIndex: -1 (none selected)
For each radio button, set:
GroupName: Gender
Text: Male/Female/Other (respectively)
Give meaningful names to controls you'll reference in prompts:
- Name TextBox:
txtName - Age ComboBox:
cmbAge - Male Radio:
radMale - Female Radio:
radFemale - Other Radio:
radOther - Newsletter Checkbox:
chkNewsletter - Submit Button:
btnSubmit - Clear Button:
btnClear - Result Labels:
lblResultName,lblResultAge, etc.
This is where the magic happens! Let's write prompts for each interactive element.
Double-click the Submit button and write:
When this button is clicked:
- Get the name from txtName
- Get the selected age group from cmbAge
- Check which gender radio button is selected (radMale, radFemale, or radOther)
- Check if chkNewsletter is checked
- Display all the information in the result labels:
- lblResultName should show "Name: " + the name
- lblResultAge should show "Age Group: " + the age group
- lblResultGender should show "Gender: " + the selected gender
- lblResultNewsletter should show "Newsletter: " + "Yes" if checked, "No" if not
- If no name is entered, show an error message "Please enter your name"
- If no age group is selected, show an error message "Please select an age group"
- If no gender is selected, show an error message "Please select a gender"
Double-click the Clear button and write:
When this button is clicked:
- Clear the text in txtName
- Reset cmbAge to no selection
- Uncheck all gender radio buttons
- Uncheck chkNewsletter
- Clear all result labels (set them to empty text)
For a more interactive experience, add prompts to other controls:
Name TextBox (OnChange event):
When the text in this textbox changes:
- If the text is not empty, change the border color to green
- If the text is empty, change the border color to red
Newsletter Checkbox (OnChange event):
When this checkbox is checked or unchecked:
- If checked, show a label saying "You'll receive our monthly newsletter!"
- If unchecked, hide that label
-
Click the ▶ Run button in the toolbar
-
Test the form:
- Try submitting with empty fields (should show errors)
- Fill in all fields and submit (should display results)
- Test the Clear button
- Test any advanced interactions you added
-
Debug if needed:
- Check the browser console for errors
- Verify your prompts are clear and specific
- Try rephrasing prompts if the AI doesn't interpret them correctly
AI doesn't understand my prompt:
- Be more specific: instead of "show error", say "display a message box with text 'Error: Please fill all fields'"
- Use control names consistently
- Break complex logic into smaller steps
Layout looks wrong:
- Adjust control positions in design mode
- Use alignment tools
- Consider responsive design for different screen sizes
Performance issues:
- Simplify prompts if they're too complex
- Reduce the number of controls if the application feels slow
-
Add validation:
- Email field with format validation
- Phone number formatting
- Date picker for birthdate
-
Improve UX:
- Loading indicators during submission
- Success messages
- Form progress indicator
-
Add more features:
- Save data to local storage
- Export results to PDF
- Multi-step wizard interface
As you work with PromptBasic IDE, you'll learn how the AI interprets natural language:
- Clear, specific instructions
- Consistent naming conventions
- Step-by-step logic
- Common programming patterns
- Ambiguous descriptions
- Complex conditional logic
- Very abstract concepts
- Platform-specific features
- Be specific: "Change the background color to blue" vs "Make it look different"
- Use control names: Reference controls by their exact names
- Break it down: Complex operations work better as multiple simple steps
- Test iteratively: Write a prompt, test it, refine as needed
- Learn from examples: Study working prompts and adapt them
- Your work is automatically saved in the browser
- For permanent storage, consider:
- Exporting the project files
- Taking screenshots of your design
- Documenting your prompts
- Share the GitHub repository link
- Provide screenshots of your application
- Document the prompts you used
- Consider creating a video walkthrough
Congratulations! You've built your first PromptBasic application. Here are some next steps:
- Explore more controls: Try ListBox, PictureBox, Timer, etc.
- Build more complex apps: Calculator, Todo list, Weather app
- Learn advanced techniques: State management, data binding, API integration
- Contribute to the project: Report bugs or suggest features
- Join the community: Share your creations and learn from others
- Check browser console for JavaScript errors
- Ensure all control names in prompts match exactly
- Try simplifying complex prompts
- Rephrase prompts to be more specific
- Break complex logic into smaller steps
- Check if the AI understands your intent
- Refresh the page and redesign
- Check control positioning and sizing
- Ensure controls aren't overlapping
For more help, check the Troubleshooting guide or create an issue on GitHub.