• 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.

Updating Fields In Form After Updating a Field

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

  • Updating Fields In Form After Updating a Field

    I have 4 fields on a form widget, one is editable and the rest are just display.
    image.png?
    I'm trying to make it where, once the user types in an item, it will then show the value for the other fields based on the item. The Item field is linked to an item app variable which is tied to the datasource for the widget. I tried refreshing the widget once the variable is updated, but that also results in clearing out the Item field. Is there a way around this?

  • #2
    It sounds like the call to refresh the widget is not sending back the record. Does your data source look for the existence of your app variable (using vvIn_virtual)?

    Comment


    • #3
      Yeah, this is the datasource:
      image.png
      ?

      Comment


      • #4
        Can you verify that the statement is in fact returning the record you are expecting?

        Comment


        • #5
          Yeah, so if i type in a valid item, for example '10100-19', using the dev console i can confirm that the item variable is showing also as '10100-19' and if i reload the widget using the dev console after having typed in the item, it will show the correct values in the widget:
          image.png?
          image.png?

          Comment


          • #6
            Something I just noticed. If i have the widget linked to a refresh app variable, when typing it will keep trying to refresh after typing in a letter or two, but if i paste the entire item into the field it works fine. Is there a different way i should go about doing the refresh as opposed to setting up a refresh variable with an expression resulting in true when they edit the item variable?

            Comment


            • #7
              Not sure I follow what is going on here. With each character you type the widget is attempting to refresh itself? How is the app variable that dictates the widget to refresh being set? Can you show the expression you are using?

              Comment


              • #8
                So, i have a different app variable called 'RefreshInquiry' tied to the 'Refresh' link to app variable field under general, and i defined it as follows:
                image.png?I just now found a way to get it to work i believe. If i set both the "Set Field Value" and "Get Field Value" link to app variable field to my "FilterItem" appvar, then when it refreshes while typing the item, it will reload the value that was stored in variable back into the item field instead of completely wiping it out

                Comment


                • #9
                  That sounds like a good solution. Next I might try and find a way to make it a bit more efficient and not refresh with each keystroke. Is there a minimum length for an item? If so you could change your expression to also check for a minimum number of characters before returning true.

                  Comment


                  • #10
                    Sadly the lengths of all of our items are extremely variable, I could probably make sure the input is at least 3 long, but it will still end up refreshing multiple times for most items. Is there by chance a way to limit the possible time between updates of an app variable?

                    Comment


                    • #11
                      At this time there is not....may be a good feature to add though.
                      If this becomes a problem you do have a couple of options:
                      • Use the form helper program. You can specify the number of milliseconds at the field level before the "change" action is called.
                        • Then your form helper would set your "RefreshInquiry" to true.
                        • One advantage to this is you could then actually check if it is a valid item before setting the app variable to true.
                      • You could use "Execute Script" at the startup of your application to add a "buffered" change listener against your item input field. When run...it could call SetAppVar to set your app variable to true. We could help you out with this one if you wanted to implement it.

                      Comment


                      • #12
                        Using the form helper program is probably a good idea for my current situation, but I'll keep the other idea in mind for other apps that aren't as bloated as the current one I'm working on. Thank you!

                        Comment

                        Working...
                        X