CA Service Management

  • 1.  Using ca_fdGetSelections

    Posted Nov 16, 2016 03:19 PM

    I am trying to populate a text field based off of text entries and drop down selections, but things aren't working they way I thought they should.

     

    My code looks a bit like this -

      description: function() {

          var one = ca_fdGetSelections(ca_fd.formId, 'one')[0].label;

          var two = ca_fdGetSelections(ca_fd.formId, 'two')[0].label;

     

          var order = "TEXT HERE" + "\n\n";

          order += "Name: " + one + "\n";

           order += "Name: " + two + "\n";

           

          ca_fdSetTextFieldValue(ca_fd.formId, 'order', order);

    },

     

    Now... one and two are both dropdowns (select fields) with their onChange’s set to this function.

     

    The problem I am having is that you have to select  BOTH dropdowns in order for “order” to get populated. Do you know why that is? It doesn’t work that way with text fields…



  • 2.  Re: Using ca_fdGetSelections
    Best Answer

    Posted Nov 16, 2016 05:50 PM

    I believe the discrepancy in behavior is related to the different data types returned by the methods. I could suggest leveraging ca_fdGetSelectedOptionValues which returns an array of strings and behaves like ca_fdGetTextFieldValue in returning an empty string:

     

    description: function() {
      var one = ca_fdGetSelectedOptionValues(ca_fd.formId, 'one');
      var two = ca_fdGetSelectedOptionValues(ca_fd.formId, 'two');


  • 3.  Re: Using ca_fdGetSelections

    Posted Nov 17, 2016 10:58 AM

    This did the trick! Thanks so much. Bacon = saved.