New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-loose-forms

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-loose-forms - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

FormInputMixin.js

@@ -7,5 +7,5 @@ var is = require("is");

if(is.fn(onChange)){
onChange(this.props.field_path, new_value);
onChange(this.props.field_name, new_value);
}
}
};

@@ -26,3 +26,3 @@ var is = require('is');

Form_validate: function(){
var fields = this.____buildSchema();
var fields = this.Form_buildSchema();
var data = this.state.data;

@@ -47,9 +47,9 @@ return validateFields(fields, data);

},
Form_onChange: function(field_path, new_value){
Form_onChange: function(field_name, new_value){
var self = this;
var fields = this.____buildSchema();
var fields = this.Form_buildSchema();
var should_validate = this.state.submit_attempts > 0;
var data = this.state.data;
data[field_path] = new_value;
data[field_name] = new_value;

@@ -60,12 +60,11 @@ this.setState({

}, function(){
self.____onFormChanged(field_path, new_value);
self.____onFormChanged(field_name, new_value);
});
},
Form_buildInput: function(field, field_path){
Form_buildInput: function(field){
var input = InputTypes.getInputByType(field.type);
return input.component({
field: field,
value: this.state.data[field_path],
onChange: this.Form_onChange,
field_path: field_path
value: this.state.data[field.name],
onChange: this.Form_onChange
});

@@ -79,2 +78,8 @@ },

},
Form_buildSchema: function(){
var schema = this.____buildSchema();
Object.keys(schema).forEach(function(name){
schema[name].name = name;
});
},

@@ -102,5 +107,5 @@ //Below are functions that the child can implement

},
____onFormChanged: function(field_path, new_value){
____onFormChanged: function(field_name, new_value){
if(is.fn(this.onFormChanged)){
this.onFormChanged(field_path, new_value);
this.onFormChanged(field_name, new_value);
}

@@ -136,4 +141,4 @@ },

var errors = {};
Object.keys(fields).forEach(function(field_path){
var field = fields[field_path];
Object.keys(fields).forEach(function(field_name){
var field = fields[field_name];
var validation_fn = defaultValidationFn;

@@ -148,5 +153,5 @@ if(is.fn(field.validate)){

}
var resp = validation_fn(data[field_path], field);
var resp = validation_fn(data[field_name], field);
if(resp !== true){
errors[field_path] = is.string(resp) ? resp : 'Please check your input.';
errors[field_name] = is.string(resp) ? resp : 'Please check your input.';
}

@@ -153,0 +158,0 @@ });

{
"name": "react-loose-forms",
"version": "0.0.2",
"description": "form library for React that is very flexible yet powerful",
"version": "0.0.3",
"description": "A form library for React that flexible and dynamic allowing it to be effective in many (if not all) situations where you need to collect user input.",
"main": "index.js",

@@ -6,0 +6,0 @@ "repository": {

# react-loose-forms
form library for React that is very flexible yet powerful
A form library for React that flexible and dynamic allowing it to be effective in many (if not all) situations where you need to collect user input.
## FormMixin
```js
var FormMixin = require("react-loose-forms");
```
## FormInputMixin
```js
var FormInputMixin = require("react-loose-forms/FormInputMixin");
```
## InputTypes
```js
var InputTypes = require("react-loose-forms/InputTypes");
```
# License

@@ -6,0 +20,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc