1
0
-1

I want to fetch the select box/ Dropbox data into a text box. How can I do it? Below is the code please help me out with this


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...

    2 answers

    1.  
      2
      1
      0
      // I think it's much easier to use jquery. I use something like this in my codes

      let $selector = FormUtil.getField('<field id>');
      $selector.each(function() {
      $(this).val('<field value>');
      });


      1. Punam

        Hey, this didn't work for me tho. The select box is not read

      CommentAdd your comment...
    2.  
      1
      0
      -1

      Ok ill try implementing this thank-you!

        CommentAdd your comment...