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

Improvement Proposal #34

Open
laurent512 opened this issue Sep 29, 2023 · 4 comments
Open

Improvement Proposal #34

laurent512 opened this issue Sep 29, 2023 · 4 comments

Comments

@laurent512
Copy link

Hello,

Just discovered your autoform component and it is great !

May I ask if it would be possible to include a "hidden" optional field.
In my casse, it would be usefull so that the schema can contain information ,but it should be sent in secret by the browser :)

Also, would it be possible to put two inputs on the same row for example? :) (like on the image below )
image

@vantezzen
Copy link
Owner

Hey, thank you for the feedback. As for hidden fields you have two options:

  1. Most likely your form submission etc. is handled inside an onSubmit handler in React. You can just add your hidden data there before sending it to the server
  2. If you use plain HTML form behaviour for form submission, you can add your own HTML elements by passing them as children (https://github.com/vantezzen/auto-form#adding-other-elements)

As for rendering multiple input elements in a row, its not currently possible like that, though it might be possible by using custom parent containers.

@laurent512
Copy link
Author

Thank you for your answer !

Concerning the hidden field, as far as I understand, both of the solutions you suggest means a different schema at the client and at the server side. The one in autoform that would not include the hidden field, and the one at the server that would include it. Ideally I would use the same, but maybe I misunderstood your proposed solutions.

Also, thank you for the many input elements in a row, if you share examples, I would be very interested :)

@nonwiz
Copy link

nonwiz commented Oct 10, 2023

Would it be possible to have a renderParent that includes all the fields instead of base on one field? @vantezzen.

<AutoForm fieldConfig={{
renderParent: ({childFieldA}, {childFieldB}, {childFieldC}) => <div>
<row>
<colA> {childFieldA} </colA>
<colB> {childFieldB> </colB>
</row>
</div>
}}> </AutoForm>

@r-ohan
Copy link

r-ohan commented Nov 1, 2023

+1 these are both killer features that would make this library drastically better.

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

No branches or pull requests

4 participants