Ticket #21 (accepted enhancement)

Opened 5 years ago

Last modified 7 months ago

New FormOpen() method

Reported by: dartar Owned by: JavaWoman
Priority: high Milestone: blue-sky
Component: core Version: 1.1.6.0
Severity: normal Keywords: forms
Cc:

Description (last modified by NilsLindenberg) (diff)

The Wikka core has a FormOpen() method that creates the opening tag for a form. However, it has a number of limitations, such as no way to specify an id and/or class attribute, and not supporting enctype needed for a file upload form. This leads to ugly workarounds and inconsistent (and sometimes invalid) code.

The following replacement for FormOpen() addresses these issues and makes sure the generated code is valid XHTML. It uses a number of new supporting methods that will be more generally useful as well.

Ref

Change History

Changed 4 years ago by NilsLindenberg

  • description modified (diff)

moved here from the SuggestionBox

I know we've dicussed this multiple times but could not find an actual suggestion; I've made it into a semi-spec.

Every form really should have an ##**id**## (attribute) to provide a 'hook' for styling (and JavaScript, if desired). We have a ##""FormOpen()""## method in the core that should be used to generate the opening ##form## tag (and its counterpart ##""FormClose())""## - but this method does not generate an ID nor accept a parameter to create one.

It should be able to do both:

accept an //optional// parameter specifying an id and - if specified - use this to generate an id attribute

if the parameter is not specified, generate one using some algorithm to ensure it will be unique on the page (possibly using all provided parameters to create a hash, supplemented with a sequence number); only problem is this id might change when adding / inserting another form into a page but that could be worked around by actually specifying an id.

In addition, some forms really need to have a ##**class**## attribute (as well); the button-form for the grabcode handler is a good example: if you have a number of forms on a page that all should have the **same** styling, a ##**class**## would provide the 'hook' rather than the ##**id**## (which should still be there).

So the ##""FormOpen()""## method should also:

accept an //optional// parameter specifying a class and - if specified - use this to generate a class attribute (and no class attribute if not specified). --JavaWoman ~&An implementation for this is now coded and tested (and will soon be added as a beta feature on this site). See AdvancedFormOpen and GenerateUniqueId for the code --JavaWoman

Changed 4 years ago by JavaWoman

  • keywords forms added

Changed 3 years ago by JavaWoman

  • owner changed from unassigned to JavaWoman
  • milestone changed from 1.1.7.2 to 1.1.7

Working on this and nearly done; setting milestone to 1.1.7

Changed 3 years ago by JavaWoman

  • status changed from new to assigned

Changed 18 months ago by DarTar

  • milestone changed from 1.2 to 1.3

Retargeting to 1.3. Code for this ticket may have already been committed to trunk, from which 1.3 will be branched. Consider backporting urgent issues to 1.2.X

Changed 7 months ago by BrianKoontz

  • milestone changed from 1.3 to blue-sky
Note: See TracTickets for help on using tickets.