This project has moved and is read-only. For the latest updates, please go here.


Access input data



I added a select control to the pop up."Open document",
                "<select id='selectBox'><option value='0'>Document_1</option><option value='1'>Document_2</option></select>",
                    new Alert.Button("Open", function() { return _this.openSelectedDocument(), true),
                    new Alert.Button("Cancel")
When I try to access the selectd value in the openSelectedDocument function like
I get 'undefined' returned. I do not get the problem, because the select control is already rendered to the DOM and the force the pop up to stay open (preventClose is true).

Is there any other "scope" or something?
Closed Feb 6 at 9:48 PM by Liger_cp <SND\Liger_cp>


Liger wrote Feb 6 at 8:58 PM


The alert.js wrapper sits outside the CRM frame, so jquery won't be able to find the elements.

You should be able to use Alert.$("#selectBox").val(); to give you context to the top document where alert.js sits.

However, I'd recommend using a web resource to hold all your HTML etc, and use Alert.showWebResource() to display it, then you can use the Alert.getIFrameWindow() function to get context of the frame, to access custom controls etc.

Hope that helps,

babyjesus wrote Feb 6 at 9:32 PM

Thank you!
That did the job! I will give the showWebResource approach a try. Maybe it could be documented a bit more detailed.


Liger wrote Feb 6 at 9:48 PM

No problem, there is some documentation on showing web resources here:

And for accessing the iframe values here:

Hope that helps,

wrote Feb 6 at 9:48 PM