
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
react-rails-form-data
Advanced tools
React component that serializes arbitrary JS objects into hidden fields for Ruby on Rails
React component that serializes arbitrary JS objects into hidden fields for Ruby on Rails
Created by UsabilityHub as a helper to serializes JS objects used by React into hidden form fields. The fields are named so that they are interpreted correctly by Rails. Can handle complex nested objects.
npm install react-rails-form-data --save
import React from 'react'
import RailsFormData from 'react-rails-form-data'
export default class FormDataExample({ uri }) {
const data = {
name: 'Jane Smith',
dateOfBirth: '1991-01-01',
favoriteColors: ['red', 'magenta']
}
return (
<form action={uri}>
<RailsFormData path='person' data={data} />
<button type='submit'>
Post {data.name}'s data to {uri}.
</button>
</form>
)
}
<form action='http://example.com/people'>
<div style='display: none;'>
<input type='hidden' name='person[name]' value='Jane Smith' />
<input type='hidden' name='person[dateOfBirth]' value='1992-01-01' />
<input type='hidden' name='person[favoriteColors][]' value='red' />
<input type='hidden' name='person[favoriteColors][]' value='magenta' />
</div>
<button type='submit'>
Post Jane Smith's data to http://example.com/people.
</button>
</form>
RailsFormData
Create a hidden div with as many hidden fields as required.
path
: string
- The key under which this object's properties will be grouped.data
: any
- The data to group.Questions, bug reports and pull requests welcome. See GitHub issues.
MIT
FAQs
React component that serializes arbitrary JS objects into hidden fields for Ruby on Rails
The npm package react-rails-form-data receives a total of 2 weekly downloads. As such, react-rails-form-data popularity was classified as not popular.
We found that react-rails-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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.