
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
react-form-data
Advanced tools
React form data is a React mixin that will allow you to get data from an html for in a nice javascript object format.
npm i react-form-data -S
or if you prefer the verbose format:
npm install react-form-data --save
onChange
handler to this.updateFormData
this.formData
var React = require('react');
var FormData = require('react-form-data');
var MyForm = React.createClass({
mixins: [ FormData ],
handleSubmit: function() {
var url = 'urlToSendDataTo';
myRequestLib.post(url, this.formData);
},
render: function() {
return (
<form onChange={this.updateFormData} onSubmit={this.handleSubmit}>
//input elements
</form>
)
}
});
Formdata supports input
, textarea
and select
elements. The name of an element is used as key in the created object and the value is fetched form the entered text, the selected option
element or the defined value
on the checked radio button.
Checkboxes can be used on two different ways.
true
or faslse
to its key.To use case 1, don't give the checkbox a value:
<input type="checkbox" name="acceptTerms" />
this.formData.acceptTerms
will be true or false depending on if the checkbox is checked or not.
To use case 2, create several checkboxes with the same name but different values:
<input type="checkbox" name="skills" value="javascript" />
<input type="checkbox" name="skills" value="coffeescript" />
<input type="checkbox" name="skills" value="haskell" />
this.formData.skills
will be an array of the checked values. E.g. [ 'javascript', 'coffeescript' ]
When adding the mixin to your component, these methods will be available on it:
Implement this method to have the form data be a non empty object in its initial state. Useful when you want to edit an existing entity. Any changes to the form will be added to this object.
Called whenever there is a change to the form. The argument is the form data object as it is after the change was made.
This repository contains a demo. To run it, clone the repo and execute npm run demo
. You can now view the demo by visiting http://localhost:3000
FAQs
React mixin to get form data in nice javascript object format.
The npm package react-form-data receives a total of 2,290 weekly downloads. As such, react-form-data popularity was classified as popular.
We found that react-form-data demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.