How can I render a suitelet form in a popup but th...
# suitescript
a
How can I render a suitelet form in a popup but then return data from the suitelet's post back to the parent window? I have file upload fields where I need to save files on form post, but then I need to return some metadata about those files back to the parent window.
u
do you have a popup built already
a
Yes, it's just a
window.open()
call on the parent window's client script with the suitelet URL
b
Use window.opener in a script returned in your response
a
Right, but I can't use that in a suitelet post
How do I get from suitelet post to client script?
b
write a form to the response
attach a client script to the form
you can alternatively write html with a script element in there
a
I'm not seeing how that connects the suitelet post logic to the client script
Once the form is submitted and posts, I'm saving files and doing other things in the suitelet. Once that's done, I need to send data from there to the form's client script.
I can't write a response with the data if the only thing that called the suitelet is a
window.open()
method
b
your suitelet can return a response to the post
that response can contain javascript that is run client side
that javascript can use window.opener to run code in the window that opened your suitelet url
a
How do I recieve that response on the attached client script?
I'm confused here because there is no client side script to send the response to in the popup
b
pick an approach
do you want to write raw html
or return a form with a client script or inlinehtml