CMS Made Simple Forums
https://forum.cmsmadesimple.org/

Accessibility on Form Builder
https://forum.cmsmadesimple.org/viewtopic.php?f=23&t=7962
Page 1 of 1

Author:  cuhlcannon [ Tue Nov 07, 2006 12:00 pm ]
Post subject:  Accessibility on Form Builder

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}

{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}


Author:  calguy1000 [ Tue Nov 07, 2006 5:05 pm ]
Post subject:  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.

Code:
{$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>

Author:  cuhlcannon [ Tue Nov 07, 2006 5:12 pm ]
Post subject:  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:
Quote:
{$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}
{$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}



Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/