Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Javascript problem with Two Option field and getting code to execute.

$
0
0

I have a Two Option field, called new_bitfield, by default the bitfield is set to true, this was done when creating the field, as you have to select a default value, so I set it as "True".

My problem is this: I have an if/else function that executes code when a field value is changed:

function bitFieldTest() {
    if (Xrm.Page.getAttribute("new_bitfield").getValue() == false) {
        alert("false");
    } else if (Xrm.Page.getAttribute("new_bitfield").getValue() == true) { //
        alert("true");
    }
}

If a user clicks on "True" in the Two Option field, I can't get the code to trigger an alert or execute the corresponding code. This is because the value was already set to "true", so there is no real change, thus the code is not executed. Is there a solution to this?


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>