Disable entire form elements with respect to a state. React

I am disabling the inputs using the isFetching prop, but this is getting reduntant as I have to keep this in every input field. Is there a way to disable the entire form? Like a disable property in <form> tag or something?

<form>
  <input type="text" disabled={this.props.isFetching} />
  <input type="text" disabled={this.props.isFetching} />
</form>

Answers


I think this should solve your problem https://stackoverflow.com/a/17186342/3298693.

You should insert your form inside an element <fieldset disabled="disabled">. This will make the whole form disabled.


I had the same issue and this worked for me:

 <fieldset disabled={true}>

Where true would be some "prop.setting"...


Just use <input type="text" disabled> wherever you want the input text to be disabled. It hardly takes some time.


Need Your Help

Not able to send data to a UDP IPv6 socket until I ping

python sockets udp ping ipv6

I am writing a program to send/receive data to a device using an IPv6 UDP port. My python code is running on a Win7 platform and the device is a piece of custom hardware. The PC and device are dire...

Uploading existing database through Plesk

asp.net sql-server database web-hosting plesk

I was trying to upload the database of my ASP.NET website. On the local machine, if I copy the database from another machine, I have to attach it through SQL Server Management Studio and then use i...