locked
Clear a multiple textbox, using Java RRS feed

  • Question

  • Hi,

    I am quite new to developing in Java. But I really want to learn it. This is my challenge.

    There is already a function that shows en hide fields. When I chose a for Yes the textbox disappears but the textbox still has al value in it. I want to erase that value when the user choses Yes.

    Could anyone help me?

    Thanks!

    Thursday, October 25, 2012 7:47 AM

Answers

  • yes you can do like below

     var Response = confirm("your message ??");
                        if (Response == true) {

    Xrm.Page.getAttribute("fieldname").setValue(null);

    }


    Contact Me
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Thursday, October 25, 2012 10:10 AM
    Moderator

All replies

  • Hi,

    It seems you are using javascript to customize ms crm but you did not mention which MS CRM version you are using. if you are using MS CRM 4.0 you can clear value like blow

    crmForm.all.yourfieldname.DataValue=null; //make sure to change field names accordinly

    for MS CRM 2011

    Xrm.Page.getAttribute("fieldname").setValue(null);


    Contact Me
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Thursday, October 25, 2012 9:47 AM
    Moderator
  • I am sorry it is CRM 2011.

    I will explain me further :

    function hg_indfotoformulierakkoord_onchange() {
        var bron = GetValue("hg_indfotoformulierakkoord");

        if (bron) {
            SetVisibleProperty("hg_opmerkingindfotoformulier", false);
        }
        else {
            SetVisibleProperty("hg_opmerkingindfotoformulier", true);
        }
    }

    When it is false te comment box appears but when a user checks true the box should be empty even when it's filled.

    Is this possible?

    Thursday, October 25, 2012 10:03 AM
  • yes you can do like below

     var Response = confirm("your message ??");
                        if (Response == true) {

    Xrm.Page.getAttribute("fieldname").setValue(null);

    }


    Contact Me
    Follow me on Twitter
    Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question.

    Thursday, October 25, 2012 10:10 AM
    Moderator
  • I have expanded the function with the code you wrote:

    function hg_paspoortidakkoord_onchange() {
     
             var bron = GetValue ("hg_paspoortidakkoord")

      if (bron) {
             SetVisibleProperty("hg_opmerkingpaspoortid", false);
        }
        else {
             SetVisibleProperty("hg_opmerkingpaspoortid", true);
        }

     var Response = confirm("Weet u het zeker?");
                         if (Response == true) {
     
    Xrm.Page.getAttribute("hg_opmerkingpaspoortid").setValue(null);
     
    }

    }

    Now I get everytime I start de form a confirm message. And it only has to be cleared when the user checks true in the checkbox.

     

    Thursday, October 25, 2012 2:21 PM
  • function hg_paspoortidakkoord_onchange() {

             var bron = GetValue ("hg_paspoortidakkoord")

      if (bron) {

             Xrm.Page.getAttribute("hg_opmerkingpaspoortid").setValue(null);
             SetVisibleProperty("hg_opmerkingpaspoortid", false);
        }
        else {
             SetVisibleProperty("hg_opmerkingpaspoortid", true);
        }

    }

    I have done it :) Thanks for your help!

    Thursday, October 25, 2012 3:40 PM