What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Passing drop down display text along with value?

    Asked by illone on January 22, 2013 at 09:40 PM

    Is there a way to pass the display text along with the value for a drop down? I have a dropdown with many ticket options for sections/rows/seats and some are the same price. I coded a total field which uses the "value" numbers to calculate the total and if I insert any letters the code stops working. So I need to keep the value as just numbers but when receiving the email, we need to know which ticket option they choose. Thanks.

  • Profile Image
    JotForm Support

    Answered by Welvin on January 23, 2013 at 05:10 AM

    Hi,

    Are you somehow using the form full source codes and injected the scripts to calculate data that have been entered on your form field? If so, can you please share with us the URL of the page where the form is placed so we can check?

    With regards to the notifications, of course you will get what they selected from your dropdown options. Don't you? How about checking the form notifications field variable settings for possible changes?

     

    Thanks

  • Profile Image

    Answered by illone on January 23, 2013 at 07:59 PM

    http://footballhoops.com/tickets.html  <--- Link to the form

     

    I receive the answer of the drop down in the email notification but it only has the number that I used in the value field. For example, one selection is for a VIP ticket that is $300. The value field is 300 so that way I can use the javascript to do the totaling with the quantity. When I get the email notification it displays the value (300) but like I say is there a way to add the display text so that it mentions VIP ticket along with it so that tickets that are the same price are mentioned so that we know which one they chose.

     

    Thanks

  • Profile Image

    Answered by jeanettebmz on January 23, 2013 at 08:56 PM

    Like Welvin asked to you, we would like to see the form so we can help you further

  • Profile Image

    Answered by illone on January 23, 2013 at 09:27 PM

    A link was provided in the last response but it is -

     

    http://footballhoops.com/tickets.html

  • Profile Image
    JotForm Support

    Answered by idarktech on January 23, 2013 at 10:24 PM

    Hi,

    Wow! You must have a good coding skills =). Nice work on the total functionality.

    How about using RegExp to replace all the non-digit characters? Example:

    var myString = 'text125.2';

    myString = myString.replace(/[^\d]/g, ''); // result will be 1252

    Let us know if you have further questions. Thanks!

  • Profile Image

    Answered by illone on January 24, 2013 at 11:39 PM

    Thank you. That worked. Here is what I have:

     

    function code() {
        var varone = document.getElementById('input_7');
        var vartwo = document.getElementById('input_23');
        var cost = document.getElementById('cost');

        var total = parseFloat(varone.value.replace(/[^\d]+/g, '')) * parseFloat(vartwo.value.replace(/[^\d]+/g, '')) + 5;
        cost.value = total;
    }

  • Profile Image
    JotForm Support

    Answered by idarktech on January 25, 2013 at 01:04 AM

    Hi,

    Glad it helps and thank you for sharing the final code. This would be useful for others.

    Cheers!