B2C Custom Content - Output claim value as hidden field

Viewed 521

Is there a way to output a claim as a hidden field (input type="hidden") so that it can be used inside custom JavaScript inside AAD B2C?

Setting a default value on a "ReadOnly" DisplayClaim gets the value out to the page:

      <ClaimType Id="myClaim">
        <DisplayName>DEBUG: Never display this</DisplayName>        
        <DataType>string</DataType>
        <UserInputType>Readonly</UserInputType>
      </ClaimType>

but then you have to goto extra lengths to hide it that may become fragile if the B2C HTML DOM output format ever changes:

var myClaim = document.getElementById("myClaim"); //too bad this cant just be a hidden field
var myClaimValue = myClaim.value; 
myClaim.parentElement.parentElement.style.display = "none"; //hide parent div's parent li
1 Answers
Related