insin / get-form-data Goto Github PK
View Code? Open in Web Editor NEWGets form and field data via form.elements
License: MIT License
Gets form and field data via form.elements
License: MIT License
var form = document.querySelector('#productForm')
executing the above line gives the following error:
TypeError: document.querySelector is not a function
I have an use case here where I still would like to have form data from disabled inputs as well. Possible to add this within a new option?
For example, this doesn't work:
<select name="length">
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12" selected>12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
</select>
But if I change it to name="abc"
it does.
i am trying to use import getFormData but i could not find the reference?
An Array of Files if it has multiple
, the first File otherwise
This would also obviate the need for a small part of the FileField
specific changes happening for insin/newforms#61
I am getting different form data on both IE and Chrome. On IE11, the form data is incorrect
First off, great lib - thanks for making it!
I think this lib could be better if it simply ommitted inputs when the elementName is null or empty. As it is today, it will raise an exception and kill the entire form scraping process.
Some possible solutions: getNamedFormElementData() could be made to return null instead of throwing an error when elementName is falsey, OR getFormData() could skip the call to getNamedFormElementData() whenever the current iteration's elementName is falsey.
How to get boolean values instead 'on'/'off'
It would be nice if there were typescript definitions for this module. I'm currently using a custom definition in my project:
type FormData = Record<string, boolean | string | string[] | File | File[]>
declare module 'get-form-data'; {
function getFormData(form: React.EventTarget): FormData;
export default getFormData;
}
it's very accurate, but what a keyboardful!
Deprecate getNamedFormElementData
in the next 1.x minor release and remove it in 2.x.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.