<div class="nms_subscribe">
  {if isset($message) && $message ne ""}
    {if isset($error) && $error == 1}
      <div class="danger">{$message}</div>
    {else}
      <div class="success">{$message}</div>
    {/if}
  {/if}
  {if isset($lists) && count($lists)}
    {$formstart}{$formhidden|default:''}
    {* a simple honeypot captcha. *}
    <input type="text" name="{$actionid}nms__data" value="" style="display: none;"/>

    <div class="row">
      <p class="col-md-3 text-right"><label for="nms_email">*{$mod->Lang('emailaddress')}:</label></p>
      <p class="col-md-9">
        <input type="text" id="nms_email" name="{$actionid}nms_email" value="{$user.email}" size="50" maxlength="150"/>
      </p>
    </div>
    <div class="row">
      <p class="col-md-3 text-right"><label for="nms_name">{$mod->Lang('name')}:</label></p>
      <p class="col-md-9">
        <input type="text" id="nms_name" name="{$actionid}nms_username" value="{$user.username}" size="30" maxlength="150"/>
      </p>
    </div>

    {if isset($fields)}
      {foreach $fields as $name => $obj}
        {$the_id="nms_field_{$obj.id}"}
        {$the_name="{$actionid}nms_field_{$obj.id}"}
        {$the_val=''}{if isset($user.fields[$obj.id])}{$the_val=$user.fields[$obj.id]}{/if}
        <div class="row">
          <p class="col-md-3 text-right">
            <label for="{$the_id}">{if $obj.required}*{/if}{$obj.prompt}:</label>
          </p>
          <p class="col-md-9">
            {if $obj.type == 'textbox'}
              <input id="{$the_id}" type="text" name="{$the_name}" value="{$the_val}" {if $obj.required}required{/if}/>
            {elseif $obj.type == 'textarea'}
              <textarea id="{$the_id}" name="{$the_name}" {if $obj.required}required{/if}>{$the_val}</textarea>
            {elseif $obj.type == 'checkbox'}
              <input id="{$the_id}" type="checkbox" value="1" name="{$the_name}" {if $obj.required}required{/if} {if $the_val==1}checked="checked"{/if}/>
            {elseif $obj.type == 'dropdown'}
              <select id="{$the_id}" name="{$the_name}"/>{html_options options=$obj.options selected=$the_val}</select>
            {/if}
          </p>
        </div>
      {/foreach}
    {/if}

    {if count($lists) == 1}
      {foreach $lists as $name => $row}
      <input type="hidden" name="{$actionid}nms_lists[]" value="{$row.listid}"/>
      {/foreach}
    {else}
      {foreach $lists as $name => $row}
      {$the_id='list_'|cat:{$row.listid}}
      <div class="row">
        <p class="col-md-3"></p>
        </p>
        <p class="col-md-9">
          <input type="checkbox" id="{$the_id}" name="{$actionid}nms_lists[]" value="{$row.listid}" {if in_array($row.listid,$user.lists)}checked="checked"{/if}/>
          <label for="{$the_id}">{$row.name}</label>{if $row.description}<br/>{$row.description}{/if}</p>
        </p>
      </div>
      {/foreach}
    {/if}

    {if isset($captcha)}
    <fieldset>
      <legend>{$mod->Lang('captcha_title')}</legend>
      {$captcha}
      {if $captcha_needs_input}
      <div>
        <label for="captcha">{$mod->Lang('prompt_captcha')}:</label>
        <input id="captcha" name="{$actionid}captcha" size="10" maxlength="10"/>
      </div>
      {/if}
    </fieldset>
    {/if}
    <div class="row">
      <p class="col-md-3"></p>
      <p class="col-md-8">
        <input type="submit" name="{$actionid}nms_submit" value="{$mod->Lang('submit')}"/>
      </p>
    </div>
    {$formend}
  {/if}
</div>{* .nms_subscribe *}