Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow decimal in number input field #2149

Merged
merged 1 commit into from
Feb 29, 2024
Merged

Conversation

Dhruwang
Copy link
Contributor

What does this PR do?

Fixes 1943

How should this be tested?

Enter decimal in number input field

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

Copy link

vercel bot commented Feb 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Feb 28, 2024 10:20am
formbricks-com ⬜️ Ignored (Inspect) Feb 28, 2024 10:20am

Copy link
Contributor

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

packages/surveys/src/components/questions/OpenTextQuestion.tsx

Consider adding a conditional check to only include the 'step' attribute when the input type is 'number'. This will make the code more readable and maintainable.
Create Issue
See the diff
Checkout the fix

    <input
      ref={openTextRef}
      tabIndex={1}
      name={question.id}
      id={question.id}
      placeholder={question.placeholder}
      required={question.required}
      value={value ? (value as string) : ""}
      type={question.inputType}
      onInput={(e) => handleInputChange(e.currentTarget.value)}
      autoFocus={autoFocus}
      className="border-border bg-survey-bg focus:border-border-highlight block w-full rounded-md border p-2 shadow-sm focus:outline-none focus:ring-0 sm:text-sm"
      pattern={question.inputType === "phone" ? "[0-9+ ]+" : ".*"}
      title={question.inputType === "phone" ? "Enter a valid phone number" : undefined}
      {...(question.inputType === 'number' ? { step: 'any' } : {})}
    />
git fetch origin && git checkout -b ReviewBot/The-a-tz5ll0l origin/ReviewBot/The-a-tz5ll0l

@jobenjada jobenjada added this pull request to the merge queue Feb 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 28, 2024
@jobenjada jobenjada merged commit 89eee21 into main Feb 29, 2024
16 checks passed
@jobenjada jobenjada deleted the decimal-in-number-field branch February 29, 2024 07:46
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.

None yet

2 participants