Skip to content

fix validation skipping#60

Open
wynn987 wants to merge 2 commits into
choonkeat:mainfrom
wynn987:fix-validation-skipping
Open

fix validation skipping#60
wynn987 wants to merge 2 commits into
choonkeat:mainfrom
wynn987:fix-validation-skipping

Conversation

@wynn987
Copy link
Copy Markdown

@wynn987 wynn987 commented Apr 22, 2026

problem: users are able to bypass invalid states in the field settings by creating a new input with valid state

video shows

  • create an input with no label, cant submit
  • create an input with label, can submit even tho above input still invalid
bug.mov

same thing for dup checks

  • input with dup name is invalid
  • but adding another valid input after that is valid
emailbug.mov

after fix

actions will be disabled if field settings are invalid

for dup

fixdup.mov

for empty

afterfix.mov

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 22, 2026

Deploy Preview for tiny-form-fields ready!

Name Link
🔨 Latest commit 6948ecf
🔍 Latest deploy log https://app.netlify.com/projects/tiny-form-fields/deploys/69f809080c45bf0008791a9d
😎 Deploy Preview https://deploy-preview-60--tiny-form-fields.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread src/Main.elm Outdated
Comment thread src/Main.elm

else
[ Attr.pattern ".*" ]
[ Attr.pattern ".+" ]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

more accurate since we do want them to fill this in (it is a required field even without the pattern)

Comment thread src/Main.elm
div [ class "tff-error-text" ] [ text "Question titles must be unique in a form" ]

else if isEmptyLabel then
div [ class "tff-error-text" ] [ text "Question title cannot be empty" ]
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

since we show err message for duplicate, why not also empty

@choonkeat
Copy link
Copy Markdown
Owner

choonkeat commented May 2, 2026

Tff Agent Chat.pdf

Discuss

Note: in a conversation, the human speech bubbles would be more noteworthy than the agent's speech bubbles

Comment thread src/Main.elm
, Cmd.none
)
( Just prevIndex, _ ) ->
if selectedFieldIsInvalid model then
Copy link
Copy Markdown
Author

@wynn987 wynn987 May 4, 2026

Choose a reason for hiding this comment

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

i kept the if selectedFieldIsInvalid model then and added an animation if user tries to click away because i think its still a better ux than allowing them to close the tab and not understand why the form is invalid

the scattering of if statement is addressed in #60 (comment)

yellow.mov

Comment thread src/Main.elm
, value (Json.Encode.encode 0 (encodeFormFields model.formFields))
]
[]
:: viewEditorValidationGate model.formFields
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

validate form on model update instead of only scattering if selectedFieldIsInvalid

Comment thread index.html
Comment on lines +302 to +305
app.ports.scrollIntoView.subscribe((id) => {
var el = document.getElementById(id);
if (el) el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
});
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

on top of animating an invalid field, it scrolls to it

if selectedFieldIsInvalid model then
                        ( { model | viewMode = Editor { maybeAnimate = Just ( prevIndex, AnimateYellowFade ) } }
                        , Cmd.batch
                            [ Process.sleep animateFadeDuration
                                |> Task.perform (always (SetEditorAnimate Nothing))
                            , scrollIntoView ("tff-field-" ++ String.fromInt prevIndex)
                            ]
                        )

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