Popup with field editor and reference field won't save (Brooklyn)

  • 1
  • Problem
  • Updated 2 years ago
  • Solved
This is on the Brooklyn platform.

I have an entity (ControlObj) with a FK reference to an entity (ControlObjType).  I have a Global Action follows a set of steps outlined in "https://docs.skuid.com/latest/en/skuid/components/popup/index.html"; to create an empty row in a separate model that supplies the field editor and activating the popup.  

I'm using a reference field for the ControlObjType on the single row model and a picklist control in the popup field editor to limit choices for the ControlObjType field.  The works by showing the appropriate values and allows me to choose one.  I've included an action step to run a snippet to "alert" me with the value stored from the picklist in the model and it is correct.

However, when I click the save button, the "saving message" popups and never completes the save, i.e., just sits there indefinitely.  If I leave the field as a Number field and not a reference field, and I type an appropriate value in the field, the save works just fine.

I've studied the tutorial very carefully so I'm wondering if I'm still doing something wrong or if this is something that didn't get migrated to Brooklyn successfully. 
Photo of Mark Ebersole

Mark Ebersole

  • 570 Points 500 badge 2x thumb
  • frustrated

Posted 2 years ago

  • 1
Photo of Amy Dewaal

Amy Dewaal, Official Rep

  • 8,200 Points 5k badge 2x thumb
Mark,

Some questions to help investigate:
  • What's a FK reference?
  • Can you give some more details around "I'm using a reference field for the ControlObjType on the single row model and a picklist control in the popup field editor to limit choices for the ControlObjType field", and maybe include some screenshots of the setup? I can't quite grasp what you're doing there.
Thanks!
Photo of Mark Ebersole

Mark Ebersole

  • 570 Points 500 badge 2x thumb
FK is a foreign key reference, i.e., there is an integer field in the ControlItem to the entity that holds a list of ControlItem types.  (I guess I called these ControlItem's instead of ControlObj's.  Need to clarify this to make screen shots make sense)

Hopefully, you checked out the tutorial page I referenced, which would help you understand what I'm doing.
Essentially, I have a model called ControlItem that contains all the rows in my ControlItem entity which I connect to a Table object.
The Table object contains a Global Action button that is used for creating and inserting a new ControlItem row.  I chose this instead of in-line inserts.  This method is outlined in the tutorial page I included.
The last step/action of the Global Action button is to generate a popup with a Field Editor object with a different model called NewControlItem attached to it.  In NewControlItem, I have a field called ControlItemTypeID which Display Type is Reference, where the reference information points to an entity called ControlItemType.  On the popup screen, the Field Renderer is set up as Picklist where the Option Source is model.
As I mentioned, the picklist shows correctly and, as I mentioned, I have been able to have a Javascrip alert show me that the right value is inserted in the NewControlItem model before the save happens.  Here are a few screen shots:






Photo of Mark DeSimone

Mark DeSimone, Official Rep

  • 11,050 Points 10k badge 2x thumb
Is it possible that the field you're attempting to save to has restrictions on it, such that a number would be allowed, but a string of text might not be? Also, when you try to save, and the save action gets stuck, do you see any error messages in the browser console?
Photo of Mark Ebersole

Mark Ebersole

  • 570 Points 500 badge 2x thumb
Through trial and error I finally figured out that I need to set the model field type as Picklist, not reference.  I then set the reference source the same way as I had been.  The field type comes into the Field Editor as Picklist as expected.  I then provide labels, etc., and Field Renderer as REFPICK and all works as expected.

BTW, the suggestion to check the browser revieled that there was an unhandled field type exception which got me to thinking about things.  Thanks for the suggestion.