web
You’re offline. This is a read only version of the page.
close
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,211

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

I have the same question (0)
  • Suggested answer
    Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    Hi Shahbaaz,

    If it is checkbox or radio button then try below syntax:

    $('#element').prop('checked', true);

    If it is dropdown:

    $("#element").val("1");

    Hope it helps.

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    it is radio button i used below code,

    $(document).ready(function(){  

      $('#adx_partnercreated').prop('attribute', true);

    });

    not working

  • Verified answer
    Shaminderpal Singh Profile Picture
    1,565 on at

    Hi Shahbaaz ,

    You can set the value using below

    Replace checkemail with your schema

    $(function(){

    $('#checkemail  #checkemail_0').prop('checked',true); //Set No value

    $('#checkemail  #checkemail_1').prop('checked',true);//Set Yes value

    });

    I have tested it as well  .Below is the screenshot.

    7713.check.PNG

    -Shaminder

  • Verified answer
    Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    Each radiobutton has its own element Id. So Try this:

    $('#adx_partnercreated_0').prop('checked', true);

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

    Hope it helps.

    -Arpit

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    thanks shaminderpal, it worked.

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

  • Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

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

  • Shahbaaz Ansari Profile Picture
    6,211 on at

    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

  • Suggested answer
    Arpit Shrivastava Profile Picture
    7,518 User Group Leader on at

    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
    6,211 on at

    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
    7,518 User Group Leader on at

    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');

    });

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans