You are here: Foswiki>Tasks Web>Item823 (30 Apr 2011, ArthurClemens)Edit Attach

Item823: FormPlugin thinks beforeclick text is valid entry

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release:
Applies To: Extension
Component: FormPlugin
Branches:
Reported By: ArthurClemens
Waiting For:
Last Change By: ArthurClemens
beforeclick text is removed when clicking in the field, then the field is empty. Still the validation code thinks the field contains information, so no error goes off when submitting.

Test code:

%STARTFORM{
name="dropdownform"
action="view"
topic="%WEB%.%TOPIC%"
method="POST"
validate="on"
}%
%FORMELEMENT{
type="text"
name="To"
beforeclick="Who is going to read this"
mandatory="on"
}%
%FORMELEMENT{
type="text"
name="Subject"
beforeclick="What is it about"
mandatory="on"
}%
%FORMELEMENT{
type="submit"
buttonlabel="Submit"
}%
%ENDFORM%

-- ArthurClemens - 20 Jan 2009

This is a fix using javascript:

for(var i=0; i<document.dropdownform.elements.length; i++)
{
   if (foswiki.CSS.hasClass(document.dropdownform.elements[i], 'foswikiInputFieldBeforeFocus')) {
      document.dropdownform.elements[i].value = '';
   }
}

but the solution should be done in FormPlugin code:
  • if has field beforeclick, check if value is the beforeclick value, if so, clear value

-- ArthurClemens - 16 Jan 2010

Fixed in FormPlugin 2.0.

-- ArthurClemens - 30 Apr 2011

ItemTemplate edit

Summary FormPlugin thinks beforeclick text is valid entry
ReportedBy ArthurClemens
Codebase
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Extension
Component FormPlugin
Priority Normal
CurrentState Closed
WaitingFor
Checkins
ReleasedIn n/a
Topic revision: r3 - 30 Apr 2011, ArthurClemens
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