-
Notifications
You must be signed in to change notification settings - Fork 3
Add EqualsField field logic #49
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
Conversation
✅ Deploy Preview for tiny-form-fields ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
| equalsFieldDisabled = | ||
| List.isEmpty candidateFieldsExceptSelf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in #50
48c2d25 to
6b954bc
Compare
6b954bc to
dec4870
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| case "EqualsField": | ||
| // the value stored in Comparison.Value is the name of another field | ||
| comparisonValue := values.Get(condition.Comparison.Value) | ||
| conditionMet = fieldValue == comparisonValue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
fixed in #50 |








show.hide.field.when.values.are.equal.mp4
discussed with @alvinchoong and decided to add this field logic for the
confirm emailstory