Refreshing Relation Selector from a Widget

Hi,

I’m trying to use a relation selector to link a payment form to a licence application form. With this I wanted to do a search for the location of the application and match any that are at the awaiting payments.

I’ve created a many to many relationship for the applications and the payments which is created when a payment is created to every application that is awaiting payment and is deleted when any application has had a payment. I’ve then got a subset that matches the 2 addresses using the limit to subset (This is why I need the many to many).

The problems I’m getting is that when I search for an address with my widget even though it saves it’s not refreshing the Relation selector. Is there a way around this to update the selector without going to a new page or adding in a submit button?

Also if there’s more than one open payment search it adds the 2 searches together can I filterout so it only checks the current one?

Thanks
Robin

Hi Robin,

It would come down to your build architecture, the way the page has been configured and what you’re aiming to achieve on that specific page.

If i’ve understood your scenario, one alternative approach (if it works with what you want to achieve) is to use the ‘New Relation Popup Page’ setting offered within a relation selector, which allows you to add a related record on-the-fly, via a popup, without leaving the page and/or form.

However, if you’re familiar with Code Studio and using JavaScript, you could utilise a Fragment Callback to achieve this easily, and using logic in code to filter the right record.

Hope this helps :slight_smile:

Ok so for the relations I ended up creating an intermediary object which is created with just the location or the reference then linking via this.

I still have an issue where I need to refresh the relation selector if a widget has been used. You mention a pop up I couldn’t find one but even if it has one I’m not sure how accessible this would be.

Is there a way of submitting the form in the widget JavaScript? this would refresh the whole page otherwise I think I would just have to redirect to the same page after my widget saves all the data.

Any other thoughts would be appreciated.