Results 1 to 5 of 5

Thread: Dropdown value's

  1. #1
    Join Date
    Oct 2009
    Posts
    63

    Default Dropdown value's

    what would the coding in the computation module be to determine the value or selected index of a drop down menu... I tried everything I know.

    I am trying to determine if a text field is empty, if it is a variable is the value of the dropdown. and vice versa.


    The actual situation is I have a state drop down, and a province field... and only can have one spot in the database without messing up the structure. I am trying to determine if either the state drop down is empty or the province field is empty. The one that is not empty is written to the variable that is written in the shipping address section of the database.

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Dropdown value's

    Hi,

    The value can be tested just like any other field.

    It sounds like a simple problem of not having your default selection as empty.

    For example,
    HTML Code:
    <option>Please select a state</option>
    ...
    is *not* correct. This will result in the field always having a value.

    Instead, you need this:
    HTML Code:
    <option value="">Please select a state</option>
    ...
    If that's not the problem, please provide the URL to your form so I can take a look.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Oct 2009
    Posts
    63

    Default Re: Dropdown value's

    Here is what I have as the If statement:
    Code:
    if (s_state == 'none')
    {
    s_stateProv2 = s_stateProv;
    }
    
    if (s_stateProv != '')
    {
    s_stateProv2 = s_state;
    }
    I have the variables imported and exporting fine by placing it on the next page, it just leaves some fields blank like it wont write.


    here is the Html:

    Code:
    <select name="s_state" id="s_state"/>
    <option value="none">Other:</option>
    <option value="AL">Alabama</option>
    <option value="AK">Alaska</option>
    <option value="AZ">Arizona</option>
    <option value="AR">Arkansas</option>
    <option value="CA">California</option>.........................................
    continues on

    Im going to copy what is written in the database soon as I run a test order.

  4. #4
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Dropdown value's

    Hi,

    That all looks fine.

    But, what is the actual logic you want?

    Is it:

    • If state and province are empty, then error.
    • If state is set, store that.
    • If province is set, store that.

    OK, but what if both state and province are set?

    Here's some logic that will achieve the above:
    HTML Code:
    if (s_state != 'none')
    {
    s_stateProv2 = s_state;
    }
    elseif (s_stateProv != '')
    {
    s_stateProv2 = s_stateProv;
    }
    else
    {
      FMUserError('You must provide state or province');
    }
    
    /* s_stateProv2 is written to the database */
    Last edited by russellr; 15-Sep-2010 at 05:13 AM. Reason: Corrected typo
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  5. #5
    Join Date
    Dec 2011
    Posts
    1

    Default Re: Dropdown value's

    Hi everyone.
    This is Michael. I amvery thankfull to you who share this information about the dropdown values, because i need this information very much Thankyou for sharing.

    Thankyou

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. set two fields froma single dropdown select
    By Al_M in forum Community Support
    Replies: 0
    Last Post: 31-Mar-2008, 02:54 AM
  2. Frontpage dropdown menu selections must have a "value"
    By Jamesiv1 in forum Community Support
    Replies: 1
    Last Post: 21-Mar-2008, 10:09 PM
  3. Frontpage dropdown menu selections must have a "value"
    By Jamesiv1 in forum HOWTO Guides and Tips
    Replies: 1
    Last Post: 21-Mar-2008, 10:09 PM
  4. Dropdown Box Question
    By webstar in forum Community Support
    Replies: 0
    Last Post: 30-Nov-2007, 04:42 AM
  5. Check Boxes and POPUPS (Dropdown) notworking
    By humpfrezz in forum Community Support
    Replies: 0
    Last Post: 24-Oct-2007, 03:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •