Content outside the form tag


(Andrew Harris) #1

Is there a simple way of getting content to display outside the form tags?

 

I can use a paint layout, but that feels like a massive overkill in the circumstances.

There's just one div on my page that I need outside the <form> tag.


(Peter McLeod) #2

Hi
What issue is it causing having the div inside the form body copy? Eg presentation/layout or functional etc

Thanks

Peter


(Andrew Harris) #3

Peter,

in this case, it was a styling issue. The particular template changed the way some items were rendered.

 

In fact, though, I see it as a bigger Accessibility issue. Most assistive devices interpret content within form tags differently, to lump everything inside the form tag means you're likely putting content in a form that shouldn't be there.


(Peter McLeod) #4

Hi

I think a layout would probably be the best option. 

If the content is related to the form though - then using legend and fieldset elements (with the legend containing the content) might also work re accessibility.

Thanks

Peter


(Bart Banda) #5

What's the form tag coming from? A Custom Form? If so, could you then nest the Custom Form into a Standard page and use the Standard Page as the presentation/front end page? If you do this though, beware of caching as the standard page will send cacheable headers by default often so your form might get cached which is not good. 


(Andrew Harris) #6

Bart,

yes, custom form, and yes, nesting them is something we try to avoid for caching reasons.

As I said, I could do it with a paint layout, it just seemed a bit of a sledge hammer to squash an ant.

 

In the end, I used a little bit of javascript to change the behaviour of some elements, which was the 'lowest overhead' way around my particular problem.

 

Thanks for the response.

Andrew H