Skip to content

Conversation

@yongchongye
Copy link
Contributor

show.hide.field.when.values.are.equal.mp4

discussed with @alvinchoong and decided to add this field logic for the confirm email story

@netlify
Copy link

netlify bot commented Oct 22, 2025

Deploy Preview for tiny-form-fields ready!

Name Link
🔨 Latest commit dec4870
🔍 Latest deploy log https://app.netlify.com/projects/tiny-form-fields/deploys/68f9971d49d12d00089376a7
😎 Deploy Preview https://deploy-preview-49--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 on lines +2780 to +2781
equalsFieldDisabled =
List.isEmpty candidateFieldsExceptSelf
Copy link
Contributor Author

Choose a reason for hiding this comment

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

EqualsField option will be disabled if no value can be selected

disabled

image

enabled

image

Comment on lines +2830 to +2844
inputNode =
case comparisonOf rule of
EqualsField _ ->
-- render select of other fields (disabled if none)
if equalsFieldDisabled then
-- render a disabled text input to keep layout
input
[ type_ "text", value "", Attr.attribute "disabled" "disabled", class "tff-comparison-value" ]
[]

else
fieldSelectNode

_ ->
textInputNode
Copy link
Contributor Author

Choose a reason for hiding this comment

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

dropdown of other fields will be rendered if EqualsField is selected, else show a text input

Copy link
Owner

Choose a reason for hiding this comment

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

Screenshot 2025-11-01 at 11 23 55 AM copy

i think there's a helper function (or extract into a helper function) to render the same html structure

Screenshot 2025-11-01 at 11 23 06 AM

Copy link
Owner

Choose a reason for hiding this comment

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

fixed in #50

@yongchongye yongchongye force-pushed the EqualsField-logic branch 9 times, most recently from 48c2d25 to 6b954bc Compare October 23, 2025 01:54
Copy link
Owner

@choonkeat choonkeat left a comment

Choose a reason for hiding this comment

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

Screenshot 2025-11-01 at 11 23 55 AM

case "EqualsField":
// the value stored in Comparison.Value is the name of another field
comparisonValue := values.Get(condition.Comparison.Value)
conditionMet = fieldValue == comparisonValue
Copy link
Owner

Choose a reason for hiding this comment

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

i'm not sure (and _test.go didn't cover) what happens to checkboxes

Elm side is true for any value that is common between the two fields (intended or not)

Screenshot 2025-11-01 at 11 25 03 AM Screenshot 2025-11-01 at 11 27 08 AM

Comment on lines +2830 to +2844
inputNode =
case comparisonOf rule of
EqualsField _ ->
-- render select of other fields (disabled if none)
if equalsFieldDisabled then
-- render a disabled text input to keep layout
input
[ type_ "text", value "", Attr.attribute "disabled" "disabled", class "tff-comparison-value" ]
[]

else
fieldSelectNode

_ ->
textInputNode
Copy link
Owner

Choose a reason for hiding this comment

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

Screenshot 2025-11-01 at 11 23 55 AM copy

i think there's a helper function (or extract into a helper function) to render the same html structure

Screenshot 2025-11-01 at 11 23 06 AM

@choonkeat choonkeat mentioned this pull request Nov 10, 2025
@choonkeat
Copy link
Owner

Screenshot 2025-11-01 at 11 23 55 AM

fixed in #50

@choonkeat choonkeat merged commit dec4870 into choonkeat:main Nov 10, 2025
6 checks passed
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