Workflow Smart UI Form Not Saving Data Added Programmatically

Options
Donna Nalls
edited September 21, 2022 in Smart View #1

Hi All,

We are developing workflows for a client and working hard (and creatively) to use OOB Smart UI Forms. We have a form where we launch a webreport for data search and api lookup...then, the user selects a record and we populate the form data in the workflow form. Easy Peezy, right? (no, tkl will not be appropriate in this situation).

Alas, when we submit the form, we realize the data is not saved: 1) get error messages for required fields - even though i see the form data in the proper field. 2) submit again and even the non-required data is not saved when we get to the next step.

It seems, the user has to manually click and tab through each field for the data to be saved. I have tried tabbing through with focus() and blur(), but that does not seem to trigger the data save, either.

I'm a little befuddled and extremely annoyed. :( I am assuming there are some eventListeners applied to the form fields. I am making my way through the workflow form javascript files, but thought someone on this forum might know why this is happening and how i might resolve the issue.

Thanks, in advance!

Donna

Tagged:

Comments

  • some fields, such as userid, can actually have several hidden fields supporting them which also need to be populated so worth checking that out.

    Also, if the field has some JS checks, as you mentioned, then it may need to "moved through" to trigger those events

  • Hi Greg,

    Thanks, very much, for the response. It's definitely a javascript issue -- i have been going through the smart ui forms js files and can't seem to figure out a way to fire off the js events when i populate the fields programmatically (definitely not the hidden user fields, in this case).

    I suspect there is a link between the smart ui "alpaca" fields and the real form template fields. Because - even when I update the alpaca fields with updated classes (exactly as they get updated when I tab out of a form field), the final validation fails - i.e., does not recognize the values that i am saving in the alpaca form fields.

    It's been completely frustrating and I think, in the interest of completing the project, I am going to have to use a custom form. I really wanted to leverage the out-of-box smart ui forms for this project, but my lack of understanding all of the js has put that goal out of reach. :(

    Thanks, again, for the reply!

    Best,

    Donna

  • can you override the offending function with your own copy of it so it validates as expected ?

  • I have considered that approach. there is a section in the csui-forms.js that defines the functions for keypress, keyup, etc. I have tried to tap into the onChange -- but, it just doesn't seem to be committing the data I input from my search form.

    I also worry about changing anything related to smart ui, as every patch update seems to modify so many of these files - I suspect I would be introducing a maintenance nightmare for the client. Additionally, I don't know how i might adversely affect any of the other workflow forms we have in production. There would be a lot of regression testing before I would feel confident that something won't break.

    I know this is just my lack of javascript knowledge and, if time permitted, I would try to bring another developer in to look at it - but, I'm just concerned with being so late on what I thought would be a very simple task. :( Smart UI is so frustrating to work with; it looks like custom forms is going to be the better approach. I'm going to give this a couple more hours today, then call it a lesson in futility. ;-)

    Thank you, from the bottom of my heart, Greg, for taking the time to share your good thoughts.

    Donna