Clear an input field in module from parent app

I really need a way to clear one input field in our module.

My intuition would be to add a "Method" to the component, but that doesn't exists, so I try "Inputs" instead.

I press "Add Input", name it "clear", and set the type to "Query".

Then I add a "Success" handler that clears my input on the "Module Input Query", as that seems to be the only way.

Finally I add the module to an app and try to trigger the input. No matter what I try, "clear" is just a string, and the module only has a weird unusable "Set an output" method.

So that approach did not work. Then I tried to add a "Javascript query" to the module instead that does the same thing.

And the same thing happens. The "Javascript query" named "clear" is still just a string, no matter how I try to use it in an app.

I'd really love a way to add methods to modules - am I missing something? I feel like this is a common use case for modules :+1:

Related: Pass events back from Module

1 Like

Hey @oles! I haven't been able to reproduce this just yet. Would you mind sharing some screenshots of your setup? And I assume the workaround above doesn't work for your use case?

@victoria your lovely support team was able to help me out!

They made a copy of my minimal reproducible app and module, and made a change I had not considered - and it worked!

I'm still not sure how it actually works, but passing in a "Temporary state" and using it as the "Default value" on an input in the module - causes it to reset on submit!

I'd still love for a better or clearer way to do it, like a "Method" or "Event" input type on modules, as this feels like a workaround, and not intuitive (for me, at least) :+1:

1 Like

I'm bashing my head against this again, btw.

It's sort of working, but I'm unable to make it not trigger on page load, causing chaos in my modules.

I've tried a bunch of workarounds with temporary state, the "Disable query"-feature in queries, but nothing really solved it, and in the end, it's a mess and hard to maintain and understand :smile:

Another +1 from me on this feature - it's really important when you're using modules for shared functionality across apps - something our team is using more and more - especially now that we're using Retool for all our internal apps :+1:

Hey @oles! Thank you for the +1 :slight_smile: Noted in the thread. Do you have any questions I can help you with in the meantime?