Skip to content

Add inline validation for property form - #130

Open
Vivek5709 wants to merge 1 commit into
akshay0611:mainfrom
Vivek5709:fix/property-inline-validation
Open

Add inline validation for property form#130
Vivek5709 wants to merge 1 commit into
akshay0611:mainfrom
Vivek5709:fix/property-inline-validation

Conversation

@Vivek5709

Copy link
Copy Markdown
Contributor

Description

Implemented step-wise validation for the Property Creation Wizard to ensure users cannot proceed with incomplete required information.

Changes Made

  • Added a validateCurrentStep() function to validate the current step before allowing navigation.
  • Updated goToNextStep() to call validateCurrentStep() before moving to the next step.
  • Introduced an errors state to manage validation errors for required fields.
  • Added inline validation messages below invalid fields.
  • Highlighted invalid inputs with a red border when validation fails.
  • Automatically cleared validation errors when users corrected the input.
  • Preserved the existing UI, multi-step workflow, image upload, edit mode, and publish/save functionality.

Validation Rules

Step 1 – Basic Info

  • Property Title is required.
  • Category is required.
  • City is required.
  • State is required.

Step 2 – Images

  • At least one property image must be uploaded.

Step 3 – Pricing

  • Price per Night is required.
  • Price must be greater than 0.

Step 4 – Amenities

  • At least one amenity must be selected.

Step 5 – Review

  • Existing publish/save validation remains unchanged.

Result

  • Users cannot skip required fields.
  • Invalid fields are highlighted immediately.
  • Error messages are displayed inline.
  • Validation errors are cleared automatically once the input becomes valid.

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

@Vivek5709 is attempting to deploy a commit to the Akshay Kumar's projects Team on Vercel.

A member of the Team first needs to authorize it.

@akshay0611 akshay0611 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Add inline validation for property form

This adds step-by-step validation to the property creation wizard so users can't skip required fields. A clear, focused change.

What looks great ✨

  • The validateCurrentStep() function covers exactly the right fields — title, category, city, state, images, pricing, amenities. Thoughtful selection of what to validate at each step.
  • Nice touch: price of 0 or negative is blocked (parseFloat() <= 0), not just empty.
  • Placing the validation call inside goToNextStep() keeps the change minimal and non-invasive to the rest of the wizard.
  • Only one file changed — clean, focused PR.

Optional suggestions (feel free to ignore)

  • The PR description mentions inline error messages and red borders on invalid fields, but the implementation uses alert() dialogs. Consider upgrading to inline validation — it's a much smoother UX than browser alerts, and you already have the right logic for it.

Verdict

APPROVE — solid validation logic, no bugs, no regressions. Great work!

@akshay0611

Copy link
Copy Markdown
Owner

@Vivek5709 Mention the issues which it closes in format of

Close #(Issue No)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants