<script type="text/javascript">
$(document).ready(function(){
  $('#sel_type').change(function(){
    var v = 'field_'+$(this).val();
    $('.fieldopts').hide();
    $('div.'+v).show();
  });
  $('#sel_type').trigger('change');
});
</script>

{if $field.id > 0}
<h3>{$mod->Lang('editfielddef')}: <em>{$field.name} ({$field.id})</em></h3>
{else}
<h3>{$mod->Lang('addfielddef')}</h3>
{/if}

{$formstart}
<div class="pageoverflow">
  <p class="pageinput">
    <input type="submit" name="{$actionid}submit" value="{$mod->Lang('submit')}"/>
    <input type="submit" name="{$actionid}cancel" value="{$mod->Lang('cancel')}"/>
  </p>
</div>

<div class="pageoverflow">
  <p class="pagetext">{$mod->Lang('name')}:</p>
  <p class="pageinput">
    <input type="text" name="{$actionid}name" value="{$field.name}" size="50" maxlength="50"/>
  </p>
</div>

<div class="pageoverflow">
  <p class="pagetext">{$mod->Lang('prompt')}:</p>
  <p class="pageinput">
    <input type="text" name="{$actionid}prompt" value="{$field.prompt}" size="50" maxlength="50"/>
  </p>
</div>

<div class="pageoverflow">
  <p class="pagetext">{$mod->Lang('type')}:</p>
  <p class="pageinput">
    <select id="sel_type" name="{$actionid}type">
    {html_options options=$fieldtypelist selected=$field.type}
    </select>
  </p>
</div>

<div class="pageoverflow fieldopts field_textbox field_textarea field_checkbox">
  <p class="pagetext">{$mod->Lang('required')}:</p>
  <p class="pageinput">
    <select id="sel_type" name="{$actionid}required">
    {cge_yesno_options selected=$field.required}
    </select>
  </p>
</div>

<div class="pageoverflow fieldopts field_dropdown">
  <p class="pagetext">{$mod->Lang('dropdown_options')}:</p>
  <p class="pageinput">
    <textarea name="{$actionid}optiontext" rows="5" cols="40">{$field.optiontext}</textarea>
    <br/>{$mod->Lang('info_dropdown_options')}
  </p>
</div>
{$formend}