• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Form Helper program question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Form Helper program question

    I have a Form Helper program that is in charge of putting some default values in to some editable fields. What I was noticing is that the helper program would put the values in the fields but then they would disappear. This all happens really quickly.
    I put my form helper into Debug and stepped through the program to see if it was something in my code. Everything seemed to work correctly. Once I was done debugging, the values stayed in the fields! So as a shot in the dark, I added a sleep procedure for 1 second in my rgp code and it worked! It seems like the RPG program is finishing too quickly and the form clears the values after they are set.
    Does that make any sense? Has anyone had that trouble before.

  • #2
    It sounds like you have your form loading data. It is making a call out to its data source and then overwriting the values. Ensure that your form has Auto Load unchecked.

    Comment


    • #3
      Hello Sean, You were right about the load data. That is clearing out my values. Once I switched it to keep data, my values coming from the form helper stayed. However, now that has broke the last field on this form. I have a custom message (string of text) in the last field that is for some information about the form. My data source for this form is a bunch of cast statements for blank values, Then in the form widget, I was using custom formatting to set this set this string. As soon as I switched it to keep data, that information is not coming to the widget. So I tried added this string to the data source and its the same issue. That information is not showing on the widget if it says keep data. Last thing I tried was to use the form helper to set the value of that field like the other fields. That sorta worked. It seems like SetValues procedure has a limit to the amount of characters it can send to the front end. My string is getting cut off.
      Is there a limit to what SetValues will send to the front end?

      Comment


      • #4
        So if I understand correctly it sounds like your custom formatting for your last field is not running. This makes sense as it should not run unless you provide a value for it.

        Can you post me the code for your custom formatting? It may help me come up with a solution.

        Comment


        • #5
          Of course. No problem.

          let CUSTOM_MESSAGE =
          `<p>
          Fill in your vehicle's current mileage and estimate its mileage for next year.
          Once you fill in those values and select a condition, you will be able to save the info.
          <br>If you have any questions, or the app lists vehicles you no longer have, please email
          <a href="mailto:*********@spi-ind.com">***********@spi-ind.com</a>
          </p>
          `;

          return CUSTOM_MESSAGE;

          This part works really well before I started trying to put starting values in my editable fields. The idea is the user needs to fill out some information. If the user fills it out and saves it and then goes back into the form, I want to display their last values just in case they want to edit it.
          Attached Files

          Comment


          • #6
            Maybe try wrapping your custom formatting around the code below:

            Code:
            if (v === '' || v === 'defaultMsg'){
                // Now add your current code within this "if" statement
            }
            Then change your form helper to send back a value of "defaultMsg" for this field.

            Comment


            • #7
              I see what you are doing here. That only works if I have the widget set to Load Data, and if I set it to load data, it will clear my values from the form helper. To me, it doesn't seem like the custom formatting executes if I have the widget set to Keep Data.

              Comment


              • #8
                The next update should fix this. We have reworked the form creation process as it was susceptible to timing issues.

                Comment


                • #9
                  Sounds good. Thanks Sean.

                  Comment

                  Working...
                  X