title: CRM 2011 + Issue with Two Option Set in javascript
body: <p>Hi i have a created a small javascript functionality where in on load both the radio buttons(Two - Option Set) are set to null and when i click 'Yes' or 'No' a field becomes required.</p>
  
  <p>Here is the Code -</p>
  
  <pre><code>document.EntityScript.IsCapableOfAssistInOwnDefense_OnChange = function (context) {
  if (Xrm.Page.getAttribute("new_HasSubmitted").getValue()) != null) {
       var field = Xrm.Page.getAttribute("new_SpecifyDetail");
       field.setRequiredLevel("required");
  }
  else
      var field = Xrm.Page.getAttribute("new_SpecifyDetail");
      field.setRequiredLevel("none");
  }
  </code></pre>
  
  <p>and on load i have written this -</p>
  
  <pre><code>Xrm.Page.getAttribute("new_HasSubmitted").setValue(null);
  </code></pre>
  
  <p>Now the problem is </p>
  
  <p><b>when i click 'No' for the first time when page loads, the function does not get invoked however when i click 'Yes' the function gets invoked and after that if i click 'No' the function gets invoked </b></p>
  
  <p>Not understanding what is the problem.can anybody suggest me what is going wrong.</p>