Select box input in cutsom code

Confluence User - 06 Apr, 2020

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

forms;selectbox;customcode

5


07 Apr, 2020
confluenceUser
confluenceUser

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

07 Apr, 2020
confluenceUser
confluenceUser

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

07 Apr, 2020
confluenceUser
confluenceUser

Hey Walter, 

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

07 Apr, 2020
confluenceUser
confluenceUser

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

08 Apr, 2020
confluenceUser
confluenceUser

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!

RELATED QUESTIONS

Your answer


To answer a question you'll need an account.

Print