Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

formist

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formist - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

6

lib/field.js

@@ -31,4 +31,4 @@

// append the type to attributes, if not supplied, and if not a contentTag
if (contentTags.indexOf(this.tag) <= 0 && this.attributes.type === undefined) {
this.attributes.type = this.options.type || 'text';
if (contentTags.indexOf(this.tag) <= 0) {
this.attributes.type = this.attributes.type || 'text';
}

@@ -72,3 +72,3 @@

if (contentTags.indexOf(this.tag) >= 0) {
content = this.options.value || '';
content = this.attributes.value || '';
delete this.attributes.value;

@@ -75,0 +75,0 @@ delete this.attributes.type;

@@ -16,12 +16,2 @@

// mixin action to attributes if existing
if (this.options.action !== undefined) {
this.attributes.action = this.options.action;
}
// mixin method to attributes if existing
if (this.options.method !== undefined) {
this.attributes.method = this.options.method;
}
// default the theme object

@@ -28,0 +18,0 @@ this.options.theme = this.options.theme || {};

@@ -11,3 +11,3 @@

// if we're dealing with a radio or checkbox input tag, re-render the input inside the label
if (field.tag === 'input' && (field.options.type === 'radio' || field.options.type === 'checkbox') && field.options.label) {
if (field.tag === 'input' && (field.attributes.type === 'radio' || field.attributes.type === 'checkbox') && field.options.label) {

@@ -14,0 +14,0 @@ // we want to append to the attributes, so default if it wasn't passed in

{
"name": "formist",
"version": "0.1.2",
"version": "0.1.3",
"description": "A library to publish, consume and validate HTML5 forms.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -54,6 +54,4 @@ formist

- `action`, `String`: the action for the form. This is optional.
- `method`, `String`: the method for the form. This is optional.
- `theme`, `Object`: a key-function object defining theming overrides. This is optional.
- `attributes`, `Object`: a key-value object defining any HTML tags. This is optional.
- `attributes`, `Object`: a key-value object defining any HTML tags (including action and method). This is optional.

@@ -60,0 +58,0 @@ `formist.Form` will take an array of `Fieldset`, `Field` or `Fieldgroup` objects (`elements`).

@@ -109,4 +109,6 @@

var form = new formist.Form({
action: '/save',
method: 'post'
attributes: {
action: '/save',
method: 'post'
}
});

@@ -123,7 +125,11 @@

form.add(new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}));
form.add(new formist.Field('input', {
type: 'email'
attributes: {
type: 'email'
}
}));

@@ -142,4 +148,6 @@

var form = new formist.Form({
action: '/save',
method: 'post'
attributes: {
action: '/save',
method: 'post'
}
});

@@ -161,4 +169,6 @@

var form = new formist.Form({
action: '/save',
method: 'post'
attributes: {
action: '/save',
method: 'post'
}
});

@@ -251,4 +261,6 @@

var form = new formist.Form({
action: '/save',
method: 'post'
attributes: {
action: '/save',
method: 'post'
}
});

@@ -264,7 +276,11 @@

fieldset.add(new formist.Field('input', {
type: 'datetime'
attributes: {
type: 'datetime'
}
}));
fieldset.add(new formist.Field('button', {
value: 'Save'
attributes: {
value: 'Save'
}
}));

@@ -292,6 +308,10 @@

new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
})

@@ -311,15 +331,15 @@

new formist.Field('input', {
type: 'radio',
label: 'Yes',
attributes: {
name: 'f',
value: 'yes'
value: 'yes',
type: 'radio'
}
}),
new formist.Field('input', {
type: 'radio',
label: 'No',
attributes: {
name: 'f',
value: 'no'
value: 'no',
type: 'radio'
}

@@ -341,15 +361,15 @@ })

new formist.Field('input', {
type: 'checkbox',
label: 'Saturday',
attributes: {
name: 'day[]',
value: 'saturday'
value: 'saturday',
type: 'checkbox'
}
}),
new formist.Field('input', {
type: 'checkbox',
label: 'Sunday',
attributes: {
name: 'day[]',
value: 'sunday'
value: 'sunday',
type: 'checkbox'
}

@@ -492,3 +512,5 @@ })

form.add(new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}));

@@ -503,4 +525,6 @@

form.add(new formist.Field('input', {
type: 'text',
label: 'Label'
label: 'Label',
attributes: {
type: 'text'
}
}));

@@ -515,3 +539,2 @@

form.add(new formist.Field('input', {
type: 'text',
label: {

@@ -522,2 +545,5 @@ label: 'Label',

}
},
attributes: {
type: 'text'
}

@@ -539,5 +565,7 @@ }));

form.add(new formist.Field('input', {
type: 'text',
label: 'Label',
helpText: 'This is a hint, for a particular field.'
helpText: 'This is a hint, for a particular field.',
attributes: {
type: 'text'
}
}));

@@ -554,3 +582,2 @@

form.add(new formist.Field('input', {
type: 'text',
label: 'Label',

@@ -562,2 +589,5 @@ helpText: {

}
},
attributes: {
type: 'text'
}

@@ -575,3 +605,2 @@ }));

form.add(new formist.Field('input', {
type: 'text',
label: 'Label',

@@ -584,2 +613,5 @@ helpText: {

}
},
attributes: {
type: 'text'
}

@@ -643,3 +675,5 @@ }));

form.add(new formist.Field('input', {
type: 'email'
attributes: {
type: 'email'
}
}));

@@ -662,4 +696,6 @@

form.add(new formist.Field('input', {
type: 'email',
label: 'Email'
label: 'Email',
attributes: {
type: 'email'
}
}));

@@ -684,4 +720,6 @@

form.add(new formist.Field('input', {
type: 'email',
label: 'Email'
label: 'Email',
attributes: {
type: 'email'
}
}));

@@ -702,8 +740,12 @@

new formist.Field('input', {
type: 'email',
label: 'Email'
label: 'Email',
attributes: {
type: 'email'
}
}),
new formist.Field('input', {
type: 'text',
label: 'Text'
label: 'Text',
attributes: {
type: 'text'
}
})

@@ -726,8 +768,12 @@

new formist.Field('input', {
type: 'email',
label: 'Email'
label: 'Email',
attributes: {
type: 'email'
}
}),
new formist.Field('input', {
type: 'text',
label: 'Text'
label: 'Text',
attributes: {
type: 'text'
}
})

@@ -760,13 +806,13 @@

new formist.Field('input', {
type: 'email',
label: 'Email',
attributes: {
id: 'e'
id: 'e',
type: 'email'
}
}),
new formist.Field('input', {
type: 'text',
label: 'Text',
attributes: {
id: 't'
id: 't',
type: 'text'
}

@@ -833,6 +879,10 @@ })

new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
})

@@ -852,6 +902,10 @@

new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
})

@@ -866,6 +920,10 @@

new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
})

@@ -896,6 +954,10 @@

new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
})

@@ -915,6 +977,10 @@

new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
})

@@ -929,6 +995,10 @@

new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
type: 'text'
attributes: {
type: 'text'
}
})

@@ -960,7 +1030,11 @@

label: 'First fieldgroup, first field',
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
label: 'First fieldgorup, second field',
type: 'text'
attributes: {
type: 'text'
}
})

@@ -981,7 +1055,11 @@

label: 'Second fieldgroup, first field',
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
label: 'Second fieldgroup, second field',
type: 'text'
attributes: {
type: 'text'
}
})

@@ -997,7 +1075,11 @@

label: 'Third fieldgroup, first field',
type: 'text'
attributes: {
type: 'text'
}
}),
new formist.Field('input', {
label: 'Third fieldgroup, second field',
type: 'text'
attributes: {
type: 'text'
}
})

@@ -1024,9 +1106,13 @@

form.add(new formist.Field('input', {
type: 'text',
label: 'First field'
label: 'First field',
attributes: {
type: 'text'
}
}));
form.add(new formist.Field('input', {
type: 'text',
label: 'Second field',
attributes: {
type: 'text'
},
theme: {

@@ -1040,4 +1126,6 @@ field: function (label, content) {

form.add(new formist.Field('input', {
type: 'text',
label: 'Third field'
label: 'Third field',
attributes: {
type: 'text'
}
}));

@@ -1054,10 +1142,12 @@

form.add(new formist.Field('input', {
type: 'email',
label: 'Email'
label: 'Email',
attributes: {
type: 'email'
}
}));
form.add(new formist.Field('button', {
value: 'Save',
attributes: {
'class': 'btn'
'class': 'btn',
value: 'Save'
},

@@ -1064,0 +1154,0 @@ theme: {

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