Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Set Two option set value in Portal using Javascript

(0) ShareShare
ReportReport
Posted on by 6,205

Hi All,

I am trying to set Two option value from javascript but i am unable to do so, i have also set text field which is working fine,

below is my code,

$(document).ready(function(){

$('#tt_needs').val('test'); // text field which is working fine

$('#adx_partnercreated').val('1'); // unable to set two option set value

});

Thanks,

Shahbaaz

*This post is locked for comments

  • ScheumanRJ Profile Picture
    ScheumanRJ 76 on at
    RE: Set Two option set value in Portal using Javascript

    I couldn't get the syntax shown above to work for me either.  I'm not sure why.  But I did find this blog post from Ritika and I was able to use that approach to check the value of the radio buttons:

     Toggle field visibility based on another field in Power Apps Portals (agarwalritika.com)

    Hope that helps

  • LeoFernandas Profile Picture
    LeoFernandas on at
    RE: Set Two option set value in Portal using Javascript

    Hi Arpit,

    Could you please share me the syntax to get two option set value in Jquery. I just tried with other two syntax which are to get value from Check Box and Radio button but that didn't help me out as by default it gives me only False value while debugging though I have set the value to True.

    Thanks much,

    Leo

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Set Two option set value in Portal using Javascript

    Hi Divya,

    Please try following code:

    if($('adx_partnercreated_0').prop("checked") == true)

    {

    alert("Rafiobutton is checked." );

    }

    else if($('adx_partnercreated_0').prop("checked") == false)

    {

    alert("Radiobutton is unchecked." );

    }

    Hope it helps.

    Cheers

    Arpit

  • RE: Set Two option set value in Portal using Javascript

    This is great! How would I check if the radiobutton is checked or not in the Dynamics Portal?

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Set Two option set value in Portal using Javascript

    Did you try setting the value before making it Hidden/Readonly.

    Like this:

    $(document).ready(function(){  

    $('#adx_partnercreated  #adx_partnercreated_1').prop('checked',true);

    $('#adx_partnercreated').closest('.boolean-radio-cell').addClass('hidden');

    });

  • Shahbaaz Ansari Profile Picture
    Shahbaaz Ansari 6,205 on at
    RE: Set Two option set value in Portal using Javascript

    thanks arpit for the reply, below is the code i hide the field portal side and set the value

    $(document).ready(function(){  

     $('#adx_partnercreated').closest('.boolean-radio-cell').addClass('hidden');

      $('#adx_partnercreated  #adx_partnercreated_1').prop('checked',true);

    });

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Set Two option set value in Portal using Javascript

    Field must be present on the Portal Form. If you will turn off it's visibility from CRM form. It will not render on the portal and won't work.

    If you want to make the field readonly, then first set it's value true/false and then make it readonly instead of making it readonly first.

    Hope it helps.

    -Arpit

  • Shahbaaz Ansari Profile Picture
    Shahbaaz Ansari 6,205 on at
    RE: Set Two option set value in Portal using Javascript

    Hi Arpit/Singh,

    I have set the field value, this field is either hidden/Readonly, but when i make it as Hidden or readonly it is not setting the value of radio button to "YES"

    Thanks,

    Shahbaaz

  • Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Set Two option set value in Portal using Javascript

    You need to append '_0' or '_1' along with element Id. Updated in my comment.

  • Shahbaaz Ansari Profile Picture
    Shahbaaz Ansari 6,205 on at
    RE: Set Two option set value in Portal using Javascript

    thanks shaminderpal, it worked.

    @aprit : i tried $('#adx_partnercreated').prop('checked', true); but not working

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans