1
0
-1

Hey 

I want to write a custom code in which I have to use the inputs of select boxes used in my form. To store value of text field in variable syntax is  : var d2=$('input[name="disability"]').Val(); I used this syntax. How do I store a value of select boxes in a variable? Basically I need the syntax for the select box.

Please help me out with asap. Thank you so much in advance

    CommentAdd your comment...

    1 answer

    1.  
      1
      0
      -1

      You can use a Custom HTML Form element, write the JS code that you have and attach listener event on select box keyup.

      1. Rushikesh Haral

        what is the syntax in joget to attach listener event on select box

      2. Punam

        Hey Walter, 

        Can you please elaborate it would be a great help, as I don't have any knowledge on the listener event

      3. Anders

        You can obtain the value of a form field either with normal JavaScript, or using the utility Javascript API#FormUtil

      4. Punam

        Hey Ander , I tried doing this by form util, but I was not successful. 

        <script language="JavaScript" type="text/javascript">
            function singleSelectChangeText() {
                //Getting Value
                
         
                var selObj = document.getElementById("singleSelectTextDDJS");
                var selValue = selObj.options[selObj.selectedIndex].text;
                
                //Setting Value
                // document.getElementById("textFieldTextJS").value = selValue;



                if (selValue=="OBC"){
                    window.alert("HEY YUR RYT");
                }
                else 
                {
                    window.alert("byeeee");
                }
            }
        </script>


        This JavaScript code is perfectly running on Visual Studio, Fetching the data of the select box and displaying it in the text box, but in joget am not able to implement the code, my code is not fetching the select box data. Can you please have me out with. As this is the only place where I am tucked will be thankful if you provide me a solution for this.

        Thank You!

      CommentAdd your comment...