locked
Text field to contain dropdown value RRS feed

  • Question

  • I have a dropdownbox and when I select a value in the dropdown I want the value that I have selected to appear in a text field.

     

    Anyone know how this can be done?

    Thanks.

    Wednesday, January 11, 2012 2:28 PM

Answers

  • you can use like below

    if(Xrm.Page.getAttribute("ddlwat").getSelectedOption()!=null)
    {
    var _Value=Xrm.Page.getAttribute("ddlwat").getSelectedOption().text;
    Xrm.Page.getAttribute("txtField").setValue(_Value);
    }


    Mahain : Check My Blog
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.
    • Proposed as answer by HIMBAPModerator Wednesday, January 11, 2012 5:32 PM
    • Marked as answer by JMcCon Thursday, January 12, 2012 9:42 AM
    Wednesday, January 11, 2012 5:32 PM
    Moderator

All replies

  • You can do this through script. You can write script on the change event of the picklist attribute. Read the value of the picklist and copy this to the other text attribute

    attributeObj.getText()

    This will give you the text of the selected optionset value.

    You can check the SDK for detailed examples.

    HTH

    Sam

     


    Dynamics CRM MVP | Inogic | http://inogic.blogspot.com| news at inogic dot com

    If this post answers your question, please click "Mark As Answer" on the post and "Mark as Helpful"

    Wednesday, January 11, 2012 2:53 PM
  • For CRM 4.0

    crmForm.all.<FieldName>.SelectedText ;


    Regards Faisal
    Wednesday, January 11, 2012 3:00 PM
  • how could i do this for example:

    if my dropdown list is called 'ddlwat' and if the textbox I want the selected value to go to is called 'txtField'

    can you show me the code to pass one to the other.

    Thanks.

    Wednesday, January 11, 2012 3:10 PM
  • Put this code on change of ddlwat after ensuring that field schema names are correct

    crmForm.all.new_ddlwat.DataValue = crmForm.all.new_txtField.SelectedText ;

    Enable onchange event and publish it. Test it.

     


    Regards Faisal
    Wednesday, January 11, 2012 5:05 PM
  • you can use like below

    if(Xrm.Page.getAttribute("ddlwat").getSelectedOption()!=null)
    {
    var _Value=Xrm.Page.getAttribute("ddlwat").getSelectedOption().text;
    Xrm.Page.getAttribute("txtField").setValue(_Value);
    }


    Mahain : Check My Blog
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.
    • Proposed as answer by HIMBAPModerator Wednesday, January 11, 2012 5:32 PM
    • Marked as answer by JMcCon Thursday, January 12, 2012 9:42 AM
    Wednesday, January 11, 2012 5:32 PM
    Moderator
  • are you looking for 2011 or crm 4.0
    Hassan
    Thursday, January 12, 2012 12:22 AM
  • Thanks Mahander, that did the job.
    Thursday, January 12, 2012 9:42 AM