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

Add a render method for generating forms #374

Open
rglover opened this issue Jan 31, 2024 · 0 comments
Open

Add a render method for generating forms #374

rglover opened this issue Jan 31, 2024 · 0 comments
Assignees
Labels
feature Something new to add @joystick.js/ui Related to the @joystick.js/ui package.
Projects

Comments

@rglover
Copy link
Contributor

rglover commented Jan 31, 2024

Not 100% sure of the API for this yet, but something like this would be helpful:

form('signup', {
  classes: {
    labels: 'mod-label',
    inputs: 'mod-input',
  },
  rows: [{
    fields: [
      { label: 'Email Address', type: 'email', name: 'email_address', placeholder: 'Email Address', value: '', columns: 6 },
      { label: 'Password', type: 'password', name: 'password', placeholder: 'Password', value: '', columns: 6, hint: 'Use at least eight characters, one uppercase letter, one lowercase letter, and a special character.' },
    ]
  }]
})

This would also allow for tracking form instances on the component instance at something like instance.forms.signup which would point to the DOM node for that form for convenience. It may be out of scope, but you could even add a validation schema directly to this that would automate calling to the instance.validate_form() method.

@rglover rglover added feature Something new to add @joystick.js/ui Related to the @joystick.js/ui package. labels Jan 31, 2024
@rglover rglover self-assigned this Jan 31, 2024
@rglover rglover pinned this issue Apr 12, 2024
@rglover rglover unpinned this issue Apr 12, 2024
@rglover rglover pinned this issue Apr 12, 2024
@rglover rglover unpinned this issue Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Something new to add @joystick.js/ui Related to the @joystick.js/ui package.
Projects
1.x.x
Awaiting triage
Development

No branches or pull requests

1 participant