Code Monkey home page Code Monkey logo

draganbabic / uni-form Goto Github PK

View Code? Open in Web Editor NEW
513.0 513.0 74.0 1.09 MB

Uni-Form is a framework that standardizes form markup and styles it with CSS giving you two most widely used layout options to choose from. Anyone can get nice looking, well structured, highly customizable, accessible and usable forms. To put it simply: it makes a developer's life a lot easier. Support → http://getsatisfaction.com/uni-form

Home Page: http://sprawsm.com/uni-form/

License: MIT License

JavaScript 100.00%

uni-form's People

Contributors

craig-davis avatar dalager avatar draganbabic avatar gimler avatar gurkavcu avatar learningstation avatar petri avatar zufrieden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uni-form's Issues

Validation conflicts with multiple forms

First off I'm new to github so sorry if I'm posting this on the wrong section of this project. But I've noticed a specific behavior that should be revised. When declaring two uni-form's on a page, on the submit of one form, both forms are validated. This means that pages with a register and login form (for example) will not pass validation unless all registration and login infos are added.

A simple fix would be to scope down the validation (and search of inputs) to the focuses form instead of the entire page. Should also make the validation more efficient.

I don't dare making the change myself because I don't know if i can/don't know how :) Again, please let me know if I should submit this somewhere else.

Thanks.

use of $ instead of jQuery is causing errors

Running the latest from the repo.
I believe I'm in jQuery.noConflict mode, so there's no global $, just jQuery. When I fire $('.whatever.').uniform(), I run into errors on the second line here:

form.find(settings.field_selector).each(function () {
        var $input = $(this),

Looking through the rest of this plugin, you use jQuery instead of $, so I think this was just an oversight. If I globalize $ before calling .uniform(), the issue goes away.

allow support for input element names with a period (or any other CSS reserved char)

When using the script in a spring based application which might have nested objects as form fields; we have to use the notation as follows

        <spring:bind path="demographicInfo.gender">
          <c:forEach var="gender" items="${genderList}">
            <li><label for=""><input name="demographicInfo.gender" type="radio" class="required" value="${gender}">${gender.gender}</input></label></li>
          </c:forEach>
        </spring:bind>

this currently fails for the validation plugin required method

        if (field.is(':radio')) {
            name = field.attr('name');
            if ($("input[name=" + name + "]:checked").length) {
                return true;
            }
            return i18n('req_radio', caption);
        }
        if (field.is(':checkbox')) {
            name = field.attr('name');
            if (field.is(":checked")) {
                return true;
            }
            return i18n('req_checkbox', caption);

I changed the method to add this snippet

        var name;
        if (field.is(':radio')) {
            var rawName = field.attr('name');
            if (~rawName.indexOf('.')) {
                console.log("escaping . chanracter");
                name = rawName.replace(".", "\\.");
                console.log(name);
            } else
                name = rawName;
            if ($("input[name=" + name + "]:checked").length) {
                return true;
            }
            return i18n('req_radio', caption);
        }
        if (field.is(':checkbox')) {
            if (field.is(":checked")) {
                return true;
            }
            return i18n('req_checkbox', caption);
        }

Not sure if this is the best way to do it; but this support should be there IMHO. Also the expression name = field.attr('name') is unnecessary in the if block for checkbox.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.