CA Service Management

  • 1.  resetFields not working after form Copy

    Posted Oct 23, 2017 02:59 PM

    I have several form fields, in a hidden fieldset section, that I need to reset (to blank) after a form has finished fulfillment,  gone all the way to SDM, and then that form is copied. For some reason, some work and some do not.

    Here is an example of my code -

     

    if (_.request.status == 100) { // STATUS FOR NOT SUBMITTED - COPIED FORM
              ca_fdResetFields(ca_fd.formId, ['dateOne','dateTwo']); //WORKS

              ca_fdUnselectAllOptions(ca_fd.formId,'selectOne'); //WORKS

              ca_fdResetFields(ca_fd.formId, ['textFieldOne']); //DOES NOT WORK
              ca_fdSetTextFieldValue(ca_fd.formId, 'textFieldOne', ''); //DOES NOT WORK

    }

     

    Any thoughts?



  • 2.  Re: resetFields not working after form Copy

    Posted Oct 23, 2017 04:45 PM

    Jason_Wolfe - any ideas on this one?



  • 3.  Re: resetFields not working after form Copy
    Best Answer

    Posted Oct 23, 2017 05:24 PM

    I'm not sure ca_fdResetFields() will work for the text field in this situation however ca_fdSetTextFieldValue() should.

     

    As a quick test I added a few fields to a hidden field set and called the following onLoad of the form:

     

    init:function(){
      if (_.request.status == 100) { // STATUS FOR NOT SUBMITTED - COPIED FORM
        ca_fdSetTextFieldValue(ca_fd.formId, 'textFieldOne', ''); //DOES NOT WORK
        }
      }

     

    I then:

     

    1) Before submitting the request I called the following from the browser console (shift+ctr+i in Chrome/Firefox) to enter some text in the hidden text field:

     

     

    2) Submitted and copied the request

    3) From the copy, before submitting, I called ca_fdGetTextFieldValue() again to check the text field was empty:

     



  • 4.  Re: resetFields not working after form Copy

    Posted Oct 24, 2017 02:49 PM

    Thanks... I think there was also something wrong with the position of my code block too. I moved it under some other code and things started to work as expected.

     

    I do notice, however, that I can not unselect a radio selection using resetField either. In fact, I can't unselect it using jquery also! There is something about a copied form that REALLY holds on to it's info.



  • 5.  Re: resetFields not working after form Copy

    Posted Oct 24, 2017 06:44 AM

    Hi Stephen,

     

    Remember that, in the end, this is html and you have jquery to help you.

    You can easly do this by using browser console, as Json shown.

     

    A working catalog example is 14.x and 12.x goes like this:

     

    $('input[_id="textFieldOne"').val('')


  • 6.  Re: resetFields not working after form Copy

    Posted Oct 27, 2017 04:13 PM

    I spoke a bit too soon... you CAN unselect a radio button using jquery.

    $('input[_id="radio_id"').prop('checked', false);

    *thumbs up!*