I am trying to make a form template in form builder that actually makes an accessible form. This is where static text added is a fieldset wrapping the containing items, the form itself is a definition list (something I think is appropriate as the labels are in a sense definitions of the fields they label) and it incorporates multiple radio group etc.
If someone could aide me in the smarty part of it, I would be greatly appreciative, or even some of the accessibility stuff.
I have tried the following:
{$hidden}
{if $total_pages gt 1}{$title_page_x_of_y}{/if}
{foreach from=$fields item=entry}
{if $entry->display == 1}
{strip}
{if $entry->type == '-Static Text'}
{$entry->name}
{else}
{if $entry->required == 1 || $entry->css_class != ''} class="
{if $entry->required == 1}
required
{/if}
{if $entry->required == 1 && $entry->css_class != ''} {/if}
{if $entry->css_class != ''}
{$entry->css_class}
{/if}
"
{/if}
{if $entry->hide_name == 0}
input_id}">{$entry->name}
{if $entry->required_symbol != ''}
{$entry->required_symbol}
{/if}
{/if}
{if $entry->multiple_parts == 1}
{foreach from=$entry->input item=part}
{$part->name}
{$part->input}
{/foreach}
{else}
{$entry->input}
{/if}
{if $entry->valid == 0} <--- {/if}
{/if}
{/strip}
{/if}
{/foreach}
{$prev}{$submit}
Accessibility on Form Builder
-
- Forum Members
- Posts: 30
- Joined: Wed Jun 22, 2005 8:02 am
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Accessibility on Form Builder
Cuhl and I found a solution this in the IRC channel, here's the resulting template.
Note, there's also a one line fix in FormBuilder/classes/Form.class.php to get the template working properly
check out the svn repository for the formbuilder module and you'll see it.
Note, there's also a one line fix in FormBuilder/classes/Form.class.php to get the template working properly
check out the svn repository for the formbuilder module and you'll see it.
Code: Select all
{$hidden}
<div{if $css_class != ''} class="{$css_class}"{/if}>
{assign var=open value=0}
{if $total_pages gt 1}<div class="status">{$title_page_x_of_y}</div>{/if}
{foreach from=$fields item=entry}
{if $entry->display == 1}
{strip}
{if $entry->type == '-Static Text'}
{if $open == 1 }</fieldset>{assign var=open value=0}{/if}
<fieldset>{assign var=open value=1}
<legend>{$entry->name}</legend>{$entry->input}
{else}
{if $entry->required == 1 || $entry->css_class != ''} class="
{if $entry->required == 1}
required
{/if}
{if $entry->required == 1 && $entry->css_class != ''} {/if}
{if $entry->css_class != ''}
{$entry->css_class}
{/if}
"
{/if}
{if $entry->hide_name == 0}
<label for="{$entry->input_id}">{$entry->name}</label>
{if $entry->required_symbol != ''}
{$entry->required_symbol}
{/if}
{/if}
{if $entry->multiple_parts == 1}
<dl>
{foreach from=$entry->input item=part}
<dt>{$part->name}</dt>
<dd>{$part->input}</dd>
{/foreach}
</dl>
{else}
{$entry->input}
{/if}
{if $entry->valid == 0} <--- {/if}
{/if}
{/strip}
{/if}
{/foreach}
{if $open == 1}</fieldset>{assign var=open value=0}{/if}
<div class="submit">{$prev}{$submit}</div>
</div>
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
-
- Forum Members
- Posts: 30
- Joined: Wed Jun 22, 2005 8:02 am
Re: Accessibility on Form Builder
Got another change to the form, to incorporate the required class and star into the label. This should be accessible now:
{$hidden}
{assign var=open value=0}
{if $total_pages gt 1}{$title_page_x_of_y}{/if}
{foreach from=$fields item=entry}
{if $entry->display == 1}
{strip}
{if $entry->type == '-Static Text'}
{if $open == 1 }{assign var=open value=0}{/if}
{assign var=open value=1}
{$entry->name}
{else}
{if $entry->hide_name == 0}
input_id}"
{if $entry->required == 1 || $entry->css_class != ''} class="
{if $entry->required == 1}
required
{/if}
{if $entry->required == 1 && $entry->css_class != ''} {/if}
{if $entry->css_class != ''}
{$entry->css_class}
{/if}
"
{/if}
>{$entry->name}
{if $entry->required_symbol != ''}
{$entry->required_symbol}
{/if}
{$entry->input}
{/if}
{if $entry->multiple_parts == 1}
{foreach from=$entry->input item=part}
{$part->name}
{$part->input}
{/foreach}
{/if}
{if $entry->valid == 0} <--- {/if}
{/if}
{/strip}
{/if}
{/foreach}
{if $open == 1}{assign var=open value=0}{/if}
{$prev}{$submit}