Select fields

Discussion in 'Customization & add-ons' started by dereck_j2, Mar 19, 2007.

  1. dereck_j2

    dereck_j2 Member

    Joined:
    Aug 22, 2006
    Messages:
    42
    Hi All,

    I need a select field to hold data.

    I have created a new field in admin control panel using "Add fields".
    The field name is question1
    The field type is SQl
    The display type is Select (single value)
    The field values are:

    Father's first name|Father's first name
    Mother's maiden name|Mother's maiden name
    Town/City of birth|Town/City of birth
    Name of your first school|Name of your first school

    The size of input field is 40.

    In my form I have the following statement:

    <select name="question1" size="1" class="bodytext" id="question1" value="{$smarty.request.question1|escape}">
    </select>

    PROBLEM: when I view the form in the browser the field does not show any data that I have set up in the Control panel|Add Fields.

    What am I doing wrong, please help.

    Dereck
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    Please contact us via helpdesk.
  3. dereck_j2

    dereck_j2 Member

    Joined:
    Aug 22, 2006
    Messages:
    42
    Thanks to Alex and the team.

    Here is the solution for dropdown SELECT menus.

    SQL table has field named "question1"

    ON THE PROFILE PAGE
    example
    <select name="question1" size="1" class="bodytext" id="question1"> <option value="Father's first name" {if $user.question1 eq 'Fathers first name'}selected="selected"{/if}>Father's first name</option> <option value="Mother's maiden name" {if $user.question1 eq 'Mothers maiden name'}selected="selected"{/if}>Mother's maiden name</option> <option value="Town/City of birth" {if $user.question1 eq 'Town/City of birth'}selected="selected"{/if}>Town/City of birth</option> <option value="Name of your first school" {if $user.question1 eq 'Name of your first school'}selected="selected"{/if}>Name of your first school</option> </select>

    ON THE SIGNUP PAGE
    Example
    <select name="question1" size="1" class="bodytext" id="question1"> <option value="Father's first name" {if $smarty.request.question1 eq 'Father's first name'}selected="selected"{/if}>Father's first name</option> <option value="Mother's maiden name" {if $smarty.request.question1 eq 'Mother's maiden name'}selected="selected"{/if}>Mother's maiden name</option> <option value="Town/City of birth" {if $smarty.request.question1 eq 'Town/City of birth'}selected="selected"{/if}>Town/City of birth</option> <option value="Name of your first school" {if $smarty.request.question1 eq 'Name of your first school'}selected="selected"{/if}>Name of your first school</option> </select>

    The difference between the two codes is

    PROFILE PAGE - {if $user.question1 eq 'Fathers first name'}
    SINUP PAGE - {if $smarty.request.question1 eq 'Father's first name'}

    I hope this helps others.

    Regards

    Dereck
  4. chuck

    chuck aMember Pro Customer

    Joined:
    Aug 29, 2006
    Messages:
    2
    How would someone do this process for radio buttons?

Share This Page