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

better generate all forms #367

Closed
Vandivier opened this issue Dec 11, 2021 · 5 comments
Closed

better generate all forms #367

Vandivier opened this issue Dec 11, 2021 · 5 comments

Comments

@Vandivier
Copy link
Contributor

Vandivier commented Dec 11, 2021

What do you want and why?

As a developer, I would like appropriately detailed forms to be generated based on my model, so that I can save time!

Possible implementation(s)

when making new.tsx, add additional input fields based on the model. this could get complex quickly, but a simple starting point would be to do this only for string fields. So instead of a name input, there would be a LabeledTextField for each string field on the new model.

also the mutation could be updated appropriately, eg:

const CreateContact = z.object({
  name: z.string(),
})

Additional context

longer-term, it would be cool to automatically make a drop down so that I can pick a user. for example, consider a "Task" model or a "Contact" model like:
blitz generate all contact firstName lastName phone address addressLine2 city state zip email belongsTo:user?

then a dropdown that is prepopulated with users could be provided so that I can pick a user by a readable name instead of having to look up ID in a DB

@roshan-sama
Copy link
Contributor

Those are cool suggestions! Some of that is done in the linked PR.

When you mention the dropdown, I'm assuming this is for a form where we're creating a new record that belongs to a user, and we want a dropdown (and potentially a search filter in it) that shows a list of users that should be associated with the record right?

I'm actually not sure how we handle field relationships in the linked PR so gonna look into that actually, but it think it might be better to do that in a separate PR and ship what we have so far first, but up to Brandon and Aleksandra

@beerose
Copy link
Contributor

beerose commented Dec 13, 2021

but it think it might be better to do that in a separate PR and ship what we have so far first

Yep, agree!

@Vandivier I think this issue: blitz-js/blitz#2038 covers some of your points. The additional thing would be the dropdown, right?

@beerose
Copy link
Contributor

beerose commented Dec 14, 2021

I marked it as blocked, so that we merge @roesh's PR first.

@beerose
Copy link
Contributor

beerose commented Dec 15, 2021

I'm going to close this issue as a duplicate of: blitz-js/blitz#2038. Feel free to open a new one for all the additional features that are not included in blitz-js/blitz#2038.

@Vandivier
Copy link
Contributor Author

yall rock, thank you!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants