How to use own js file.

0
I need to do masking for phone number attribute in page using my own js files. In js file I am using function. But how should I use my Phone number attribute name in js file and aslo in html file. Below is the attribute where I want to use masking.(I am not using mendix masking)     Here is my js file. it look like this as shown in below screen     Here is my style file as shown below:     and here is html file which is outside browser I am using for testing purpose only as shown in below   Now outside mendix I can easy to use my js and css within html. But now how should I use these css and js file for my phone number attribute for masking.        
asked
1 answers
1

You can also use Mendix microflows and front end validation features.

If you want to use your scripts, you can include them in an HTMLSnippet and attach them to window or namespace them however you want.

To attach it to the keypress callbacks you can use something like this in an HTMLSnippet

try{
    dojo.query(
        '.mx-name-textBox1 input'//mbm widget attr, prefixed with .mx-name-
    )[0]
    .onkeyup=function(evt){
        //process evt.target.value
        //...
        //set input node value
        evt.target.value=processedvalue;
    }
}catch(e){
    console.error(e);
}

 

answered