You are here: Foswiki>Tasks Web>Item8772 (16 Mar 2011, GeorgeClark)Edit Attach

Item8772: Form field markup should have 'id' attribute set by renderForEdit()

pencil
Priority: Enhancement
Current State: Proposal Required
Released In: n/a
Target Release: n/a
Applies To: Engine
Component: DataForms, FoswikiUsability
Branches:
Reported By: PasiHaekkinen
Waiting For: Main.PasiHaekkinen
Last Change By: GeorgeClark
Form fields renderers Foswiki::Form::_SomeFormFieldClass_ should add id attribute in renderForEdit(). With id attribute set, you can use label tag to make more accessible forms with i.e. FlexFormPlugin.

For example in Foswiki::Form::Text this can be done like this:
sub renderForEdit {
    my ( $this, $web, $topic, $value ) = @_;

    return (
        '',
        CGI::textfield(
            -class =>
              $this->cssClasses( 'foswikiInputField' ),
            -name  => $this->{name},
            -id    => $this->{name},
            -size  => $this->{size},
            -value => $value
        )
    );
}

id attribute should be unique in HTML document. To enforce that, you can use some prefix in id value. -- PasiHaekkinen - 25 Mar 2010

We need new features to go through the feature proposal process on the Development web. Please contribute to the existing Development.CentralizeHtmlFormHandling topic so this can be discussed, because there may be additional requirements from developers other than yourself that will influence the final implementation.

For example in my own case, my applications need to also namespace these fields so that when multiple topics are presented simultaneously to the user for edit, a save handler will know which input field belongs to which topic.

PasiHaekkinen, could you please add a note with this important detail to the proposal?

Great to see we are all thinking alike.

-- PaulHarvey - 26 Mar 2010

Thanks Paul for your comment. I read the CentralizeHtmlFormHandling topic and found it a little bit out of my league. I'm new to Foswiki, so I feel that I don't have much to give in that brainstorming. I have some php QuickForm background, that's why I do like the idea of separating structure and presentation (=html) when generating forms.

-- PasiHaekkinen - 29 Mar 2010

Switched codebase to 1.1.2 and CurrentState to New.

-- PasiHaekkinen - 24 Nov 2010
 

ItemTemplate edit

Summary Form field markup should have 'id' attribute set by renderForEdit()
ReportedBy PasiHaekkinen
Codebase 1.1.2, trunk
SVN Range
AppliesTo Engine
Component DataForms, FoswikiUsability
Priority Enhancement
CurrentState Proposal Required
WaitingFor PasiHaekkinen
Checkins
TargetRelease n/a
ReleasedIn n/a
Topic revision: r5 - 16 Mar 2011, GeorgeClark - This page was cached on 23 Jan 2021 - 03:15.

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