Happy 2013 - jQuery iForm Library, Anyone?

Happy New Year, everyone! The year 2012 was quite a year, wasn't it? And with 2013 just now beginning, I see a world of possibilities ahead of us. There are some exciting and scary things coming ahead in the world of CPOE; if your facility has attested for Meaningful Use phase 1, you have an idea of what I'm talking about.

I have some projects that I would love to unveil at some point this year. One of which I'd like to get some community feedback first. I've created a jQuery plug-in specifically geared toward iForms.

So far, it includes a wide variety of functions like:

Text Input Functions

  • clearDefaultText() - removes / replaces default text (acts similar to what's described here)
  • maskInput() - prevents user entry of those pesky characters that causes VGR errors

Radio Button Functions

  • getRadio() - returns the jQuery object array of all of the radio buttons given the name
  • getRadioValue() - gets the value of the currently selected item in the named radio group
  • setRadioValue() - checks the appropriate radio button given the radio group name and value
  • makeUncheckable() - makes it possible to make a radio button act like a checkbox and be unselected by clicking it a second time

Checkbox Functions

  • check() - checks a checkbox / radio button*
  • uncheck() - unchecks a checkbox / radio button*
  • toggleChecked() - checks or unchecks a checkbox / radio button (acts similar to jQuery toggleClass)
  • checkAll() - checks all checkboxes on a form (used for debugging / testing)
  • uncheckAll() - unchecks all checkboxes on a form
  • isChecked() - returns whether a checkbox / radio button is checked (if more than one object is provided, it returns whether one or more are checked)

* These check / uncheck functions are more than just shorthand for .attr('checked',true), they also trigger the event that the related object functions below are built on. As long as events are built on that event, you don't have to worry about whether a checkbox was changed by a user's click or by a line of code.

Combo (Drop-Down) Box Functions

  • setCombobox() - sets a <SELECT> box to a value, accepts valid values OR text values
  • comboboxText() - returns the shown text for the currently selected value

Related Object Functions

  • radioCheckbox() - makes a group of checkboxes act like a radio button group. If you check one, the others specified will uncheck.
  • cascadeCheckbox() - triggers a group of checkboxes to "cascade" their checked status based on a "parent" element.
  • relatedEnabled() - changes the disabled status of one or more "child" elements based on a "parent" element
  • relatedVisible() - changes the visible status of one or more "child" elements based on a "parent" element
  • relatedToggleClass() - adds/removes a CSS class to one or more "child" elements based on a "parent" element
  • relatedSetValue() - sets the value of one or more "child" elements based on the status a "parent" element

Miscellaneous Functions

  • reset() - resets form elements
  • tryFocus() - works like focus(), but has error trapping in case the element on another tab or hidden for some other reason
  • set() - works similar to the check/uncheck functions but is used for text and combo boxes
  • vgr_init() - an updated version of the VGR initialization automation function found here

So..?

I guess the reason that I'm putting all this out here now is that I'm planning to make this library (and maybe some others) available open-source style to the community, but I'm not sure if it's ready for that yet.  While I've been able to come up with what I think are some good ideas that are useful for what I've done, I know that I haven't thought of everything.

  • If you have an idea of a function that would be widely (or wildly) useful to the community at large, I'd love to hear about it; maybe it can be added to the library.
  • If you're interested in an alpha "pre-release" type version of the library and/or are interested in contributing, let me know.

5 comments:

  1. Do you already have an accordion function? I love using those, and it's hard to find one I like the look of. I'm a novice, obviously, so I come here and check out your stuff all the time.

    ReplyDelete
  2. I do have a function that I use for collapsible sections, which is slightly different than a pure "accordion." If I were to use one, it'd probably be the one built into jQuery-UI http://jqueryui.com/accordion/ or mildly modded from it.

    ReplyDelete
  3. do you demos of these. maybe something in jsfiddle?
    we've already created some of these, so i'd like to see the difference in the behaviors if any.

    ReplyDelete
  4. I'm planning on hosting it on SourceForge or GitHub, but yeah, I'm planning to put out demos and API information. There's just enough enough hours in the day, it seems.

    ReplyDelete
  5. Have you made any progress towards releasing the jQuery plug-in for iForms?

    ReplyDelete