Opened 9 years ago

Last modified 9 years ago

#878 confirmed bug

Duplicate html <form> tags when using SimpleForms

Reported by: matthijs Owned by:
Priority: normal Milestone:
Component: fon-base-firmware Version: (Gari)
Severity: major
Cc: Hardware: both


While debugging #644, it became apparent that in some cases, there are duplicate (nested) form tags. The particular problem in #644 has been fixed, but this duplication might need some cleanup later on. For now, we'll leave this be, since it works and will require a fairly invasive change to luci requiring lost of testing.

Here's the original comment describing the problem:

Furthermore, it seems that the HTML generated for SimpleForm? is broken, it includes the header and footer with the <form> and </form> tags twice (once from header.htm and footer.htm included by dispatcher.lua and once directly from the simpleform.html template.

r504 tried to fix this for the Wizard (which uses SimpleForm?), but this fix is incomplete since it doesn't suppress the footer (the wizard still contains double </form> tags) and it doesn't fix other uses of the SimpleForm?. This fix is also not really the right way to fix this either, since it needs noheader/nofooter settings in the controller, depending on whether Map of SimpleForm? was used in the cbi files.

AFAICS, the proper fix for this problem would be to just remove the header/footer stuff from simpleform.htm and rely on the header and footer included by dispatcher.lua always. A bit more reading shows that this is exactly what the Form class (a subclass of SimpleForm?) does by setting the "embedded" attribute, which supresses the header and footer of the simpleform.htm template. Using Form for the Firewall -> Applications page also fixes the cancel button (though I've not completely grasped why yet).

However, in the wizard, just changing to Form might not be enough. In particular, the downloadmanager wizard steps already use the Form class, but explicitly include the map_head.htm template (for example at the bottom of dlmanager_mu.lua). So perhaps the noheader is still appropriate here (since the dlmanager_mu.lua also includes the custom wizard head and head_darkorange, which are normally included via header.htm from fon.lua (but the latter contains an override not to include any header in the wizard).

So in the end, most of it works out, but here and there there a few duplicate headers or footers. Changing from SimpleForm? to Form is probably fine everywhere outside of the wizard. In the wizard, things look a bit more complicated, I'm not sure what the best fix for that is (since there still are some duplicate footers in the SimpleForm? cases).

Attachments (0)

Change History (1)

comment:1 Changed 9 years ago by matthijs

  • Status changed from new to confirmed

Add Comment

Modify Ticket

as confirmed The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.