Live data from Hacker News

Show HN: React Hook Form – Simple Form Validation

react-hook-form.com

31–40 of 75 posts

Re: Show HN: React Hook Form – Simple Form Validation

#31

Hey author I like this! It's very close to what I use for simple forms, my library `forn`: import forn from 'forn'; export default () => ( console.log(data))}> Send! ); Test it: https://codesandbox.io/s/agitated-johnson-3hv96 Why do you need the register though? Is the hook needed to hold the refs? Is it only for compatibility with React Native or are there other reasons? With forn I use `e.target`, which should not…

hey, nice lib you got there :) When I was deciding the API, I did have the idea of just collecting form input automatically (similar to forn), but there are few reasons which lead to the final decision: 1. Support React controlled component. eg some of the popular component libs, they are wrapped input inside their component and it's hard to predict which to include during the form submit. 2. React Native 3. Attach v…

Ha thanks! You described perfectly the limitations of `forn` and why I only use it for simpler forms. React Native is a big pain from tine to time though I barely use it. I also made https://picnicss.com/ so I'm used to use the native form elements underneath and the rest being just a pretty wrap. But yeah, as soon as I add a 3rd party form lib all goes to hell and `forn` doesn't work well anymore.

I'll try it next time I have to deal with React Native!

Re: Show HN: React Hook Form – Simple Form Validation

#32

I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model changes. As form code is the most important entry point for security flaws in web applications it is also the most expensive and it is not a good idea having to touch production code for every little backend change. This looks like PHP coding 15 years ago. Do no…

Can you point to a real world example of what you mean? I think I have heard of something similar but it didn’t seem to have caught on in any major web frameworks that I know of (strongly typed json API server which generates runtime validators on frontend and backend). Even then most people want control over the presentation of the form and wouldn’t want to create fields from the schema (e.g. a number type is someti…

I was not writing about a specific product but about a way to implement form generation. Most web frameworks come with the basic building blocks.

Re: Show HN: React Hook Form – Simple Form Validation

#33

Earlier quoted context omitted.

hey, nice lib you got there :) When I was deciding the API, I did have the idea of just collecting form input automatically (similar to forn), but there are few reasons which lead to the final decision: 1. Support React controlled component. eg some of the popular component libs, they are wrapped input inside their component and it's hard to predict which to include during the form submit. 2. React Native 3. Attach v…

Ha thanks! You described perfectly the limitations of `forn` and why I only use it for simpler forms. React Native is a big pain from tine to time though I barely use it. I also made https://picnicss.com/ so I'm used to use the native form elements underneath and the rest being just a pretty wrap. But yeah, as soon as I add a 3rd party form lib all goes to hell and `forn` doesn't work well anymore. I'll try it next t…

wow so cool~ https://picnicss.com/ love it. stared the project. <3

Re: Show HN: React Hook Form – Simple Form Validation

#34

I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model changes. As form code is the most important entry point for security flaws in web applications it is also the most expensive and it is not a good idea having to touch production code for every little backend change. This looks like PHP coding 15 years ago. Do no…

I agree somewhat.

A plain data format (like JSON) should be used to generate Forms, so your client/server side validation is always in sync (DRY).

But this isn't mutually exclusive. You could use this component and generate the implementation (or just plainly transform your data into this with a function). Especially since it leans very heavily on the HTML standard, which has several advantages.

Having a look at the code examples and documentation it would seem ergonomic to just feed JSON into a component that uses this.

Re: Show HN: React Hook Form – Simple Form Validation

#35
post #34

I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model changes. As form code is the most important entry point for security flaws in web applications it is also the most expensive and it is not a good idea having to touch production code for every little backend change. This looks like PHP coding 15 years ago. Do no…

I agree somewhat. A plain data format (like JSON) should be used to generate Forms, so your client/server side validation is always in sync (DRY). But this isn't mutually exclusive. You could use this component and generate the implementation (or just plainly transform your data into this with a function). Especially since it leans very heavily on the HTML standard, which has several advantages. Having a look at the…

I agree. the lib itself is primitive enough for you to build a JSON formate to generate forms. here is an good example: https://github.com/start-at-root/react-breeze-form

Re: Show HN: React Hook Form – Simple Form Validation

#37

I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model changes. As form code is the most important entry point for security flaws in web applications it is also the most expensive and it is not a good idea having to touch production code for every little backend change. This looks like PHP coding 15 years ago. Do no…

Can you point to a real world example of what you mean? I think I have heard of something similar but it didn’t seem to have caught on in any major web frameworks that I know of (strongly typed json API server which generates runtime validators on frontend and backend). Even then most people want control over the presentation of the form and wouldn’t want to create fields from the schema (e.g. a number type is someti…

A friend of mine build a solution like this:

https://laraform.io/

If I have a form anything more complex than a login page, then I usually use some kind of generator based on a schema.

Re: Show HN: React Hook Form – Simple Form Validation

#38

I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model changes. As form code is the most important entry point for security flaws in web applications it is also the most expensive and it is not a good idea having to touch production code for every little backend change. This looks like PHP coding 15 years ago. Do no…

How on Earth does this remotely look like "PHP 15 years ago" to you?

Re: Show HN: React Hook Form – Simple Form Validation

#39

I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model changes. As form code is the most important entry point for security flaws in web applications it is also the most expensive and it is not a good idea having to touch production code for every little backend change. This looks like PHP coding 15 years ago. Do no…

At an earlier job, I got so annoyed with the constantly changing requirements I developed a form generator. With AngularJS. I wish I could've saved the code, it was so beautiful and horrible.

Re: Show HN: React Hook Form – Simple Form Validation

#40

I strongly recommend to automate form generation based on JSON schema what will enable zero coding for maintenance tasks like e.g. synchronization with model changes. As form code is the most important entry point for security flaws in web applications it is also the most expensive and it is not a good idea having to touch production code for every little backend change. This looks like PHP coding 15 years ago. Do no…

I'm in the process of ripping a system like this out of our main onboarding application. The idea sounded so great: "Just add another object to an array and the form field will magically appear with validation, persistence, etc". The reality is that business requirements turned it into a ton of special case "if" statements. I'm going to avoid that for the next go-round.
Post reply on HN