kylerush / oform Goto Github PK
View Code? Open in Web Editor NEWA JavaScript library for forms.
License: MIT License
A JavaScript library for forms.
License: MIT License
Needs to support custom error messages. For example, consider a password field. The password field may have certain requirements. If no value is entered into the password field "Required" may be a good error message. But if a value is entered and the value does not conform to the requirements, "Not a valid password" might be a better error message.
Would be nice to expose the form data that has been collected from the inputs in the success function if the form doesn't actually post.
doesn't execute for form POSTs
there should be an option to validate fields that don't have a required option. if the field does not have a blank string then the value should be validated even if it doesn't have the required
attribute.
this should be done by adding a data attribute to the input like so:
<input type="email" name="email" data-validate>
To reproduce:
Pull this branch
Go to http://localhost:9000/dist/sxsw/
Press submit, observe JS error in console
Comment out all of radio-option-container
in website-guts/templates/layouts/events_form.hbs
Observe no error.
need to add an option that allows you so specify when the validation option executes.
should look like this:
new Oform({
selector: '#form',
validateon: 'keyup'
});
options should be:
'keyup'
'focusin'
'focusout'
The production site changes the background of inputs to light grey while processing. I tried implementing this with the before
and load
events but it gets complicated because before
will run even if there is a validation error, and if there is a validation error load
will not fire.
instead of passing a list of arguments to the callback, should pass and object like:
{
jqXHR: ,
callback: ,
}
makes checking for successful submission easier by doing:
if(typeof args.jqXHR === 'object')
The jqXHR object that gets passed to the callback functions is not correct. The responesJSON is added to the object, but not in the responseJSON property as the documentation states.
Screenshot: http://d.pr/i/uFrJ
in the onreadystatechange potentially create events for success and statusError as the current 'error' event doesn't seem to fire on a failing status
xhr.onreadystatechange=function(){
if (xhr.readyState==4 && xhr.status==200){
}
}
}
http://stackoverflow.com/questions/10876123/how-to-find-out-if-xmlhttprequest-send-worked
The callback for customValidation has the element as a parameter not the input value. Either change the docs or the functionality
password: function(val){
if(val.length >= 7){
return true;
} else {
return false;
}
}
}
if no method
attribute is on the form tag selector Oform should not do a POST
request and instead just run a success function if the form validated correctly. the success function should still run though if there is a method
attribute after the response is received.
currently the form submits even if the before function does not return true.
in the rewrite this feature got lost. upon each form submit oform should adjust the body class. if there are validation errors, oform should add an error class to the <body>
tag. if there are no errors it should remove the class.
should be used like this:
new Oform({
selector: '#form',
bodyErrorClass: 'error'
});
default:
new Oform({
selector: '#form',
bodyErrorClass: 'oform-error'
});
to disable this feature:
new Oform({
selector: '#form',
bodyErrorClass: null
});
line 348 of oForm.js
this line does not actually execute the function:
if( instance.options.validate[type] ){
it just checks to see if the function exists. it needs to actually execute the function and pass an argument.
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.