Welcome Guest Search | Active Topics | Sign In | Register

adding "accept" attribute to buttons on contentURL form Options
brad smith
Posted: Wednesday, June 20, 2007 6:08:54 AM
Rank: Newbie
Groups: Member

Joined: 6/19/2007
Posts: 4
I am calling a URL in a modal dialog. There is a button in that form that gets loaded in the dialog that runs some code. I'd like it to work so that one button runs the code and closes the modal dialog. I tried two things to no avail:

1) Specifying the button name that's in the page loaded as ContentURL as the dialog's AcceptButton (i.e. <eo:Dialog ID="Dialog1" AcceptButton='btnAssign'...) . Does this not work when the content is not embedded in the dialog's content template?

2) in the "Page_Load" event of the ContentURL page that's being loaded, I used btnAssign.Attributes.Add("onClick", "dialog1.accept();"), but that doesn't close the dialog either.


Thanks,

Brad
eo_support
Posted: Wednesday, June 20, 2007 6:12:37 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,095
Hi Brad,

That wouldn't work. The reason is because the button and the dialog are in different pages. They need to be in the same page.

Try to put the botton into the footer template and it should work. You will find a lot of our samples uses both ContenTemplate and FooterTemplate, which fills the content region and footer region respectively. The content region is being replaced by the Url you specified when you set ContentUrl, the footer region is still free for you to use.

Thanks

Eric T
Posted: Tuesday, February 5, 2008 1:09:42 PM
Rank: Member
Groups: Member

Joined: 6/5/2007
Posts: 15
Brad,

I had this same problem with wanting a close from using a button with contentURL and I found a workaround, but due to Javascript security, you must be on the same domain (which shouldn't be a problem for most implementations).

On the page run by the ContentURL, you will just need to emit the following Javascript when you are done with the dialog:

Code: Visual Basic.NET
Response.Write("<script>parent.eo_GetObject('dlgNameHere').accept();</script>")


The key is to use the "parent" keyword and then you have access to EO's stuff. I put mine in a Postback Submit, such that:

Code: Visual Basic.NET
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
' Business logic goes here
' If something goes wrong, use Exit Sub to prevent the dialog from closing or other error handling
' Successfully done with business logic, want to close the dialog

Response.Write("<script>parent.eo_GetObject('dlgSubeditor').accept();</script>")

End Sub


It is working well for me and properly doing both the postback/business logic, and then closing when done, all from a single button on the ContentURL.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.