You are here: Foswiki>Tasks Web>Item9496 (17 Dec 2011, GeorgeClark)Edit Attach

Item9496: Implement re-usable way to set default text of input fields

Priority: Normal
Current State: Closed
Released In: 1.1.4
Target Release: patch
Applies To: Engine
Component: JQueryPlugin
Branches: Release01x01 trunk
Reported By: ArthurClemens
Waiting For:
Last Change By: GeorgeClark
I created this task because jQuery'd foswikiForm removed all classes from the input field when clicked.

This led me to do the default text smarter:
  • use class foswikiDefaultText for input fields that will contain default text
  • set the default text in the title attribute of the input field

-- ArthurClemens - 18 Aug 2010

Should be moved into JQueryPlugin and made a proper module of its own.

Instead of reading the default text from the title field, use jquery metadata.

<input type="text" class="jqDefaultText {title:'Enter your email address'}" />

That way the title attribute= is still available for tooltips.

This code should use livequery() instead of each(). See also the JQueryCodingStandards and UsingJQueryWithFoswiki

-- MichaelDaum - 19 Aug 2010

Good suggestion, will try this.

-- ArthurClemens - 19 Aug 2010

Should this go into jquery.form.js? Or into a new jquery.formfielddefaulttext.js?

The same question for other form functions like "select/deselect all" checkboxes (now in foswiki.Form).

-- ArthurClemens - 14 Dec 2010

jquery.form.js is a third-party library that we simply added as is. So we better don't mod it. Besides, although it is called "form" its purpose is quite different compared to what you are trying to do here. So anything extra should go into a jquery.module of its own.

Html5 does have a placeholder attribute. There are some articles how to provide that behavior x-browser.

-- MichaelDaum - 15 Dec 2010

Implemented as jquery module. Now I have to remove some old code.

-- ArthurClemens - 25 Apr 2011

Does not work with NoConflict; Overrides native placeholder support in modern browsers.

-- MichaelDaum - 26 Apr 2011

Remember to set a fix or enhancement of core and default extensions to WaitingForRelease. This way the happy message gets in the release notes and release brag texts. Thanks for the improvement

-- KennethLavrsen - 25 May 2011
Topic revision: r33 - 17 Dec 2011, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy