Not signed in (Sign In)

Powered by Vanilla 1.1.2.

Welcome Guest!
Want to take part in these discussions? If you have an account, please sign in. If you don't have an account, register now.
    • CommentAuthorpdaether
    • CommentTimeMay 7th 2007
     #1

    I have created a script for using Uni-Form with Prototype instead of JQuery.
    Just download uni-form.prototype.js an put it together with prototype.js in your javascript folder.
    Then replace

    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/uni-form.jquery.js" type="text/javascript"></script>

    with

    <script src="js/prototype.js" type="text/javascript"></script>
    <script src="js/uni-form.prototype.js" type="text/javascript"></script>

    and you are done.

    Here is the code:

    //Prototype script for Uni-Form by Patrick Daether - http://www.ihr-freelancer.de
    uniform = {
    settings: { valid_class : 'valid',
    invalid_class : 'invalid',
    focused_class : 'focused',
    holder_class : 'ctrlHolder',
    field_selector : '.uniForm input, .uniForm select, .uniForm textarea'
    },
    // Select form fields and attach them higlighter functionality
    init: function(){
    $$(uniform.settings.field_selector).invoke('observe','focus',uniform.changeFocus);
    },
    // Focus specific control holder
    changeFocus: function(evt){
    $$('.'+uniform.settings.focused_class).invoke('removeClassName',uniform.settings.focused_class);
    $(Event.element(evt)).up('.'+uniform.settings.holder_class).addClassName(uniform.settings.focused_class);
    }
    }// Auto set on page load...
    Event.observe(window, 'load', uniform.init );

    Tested with Prototype 1.5.1 and Uni-Form 1.2.




















    •  
      CommentAuthorDraganBabic
    • CommentTimeMay 7th 2007 edited
     #2

    Wow, thanks! This should come in handy for Marcus and the rails plugin he's making. Also I am putting it to the resources section.