Hi all,
I have a Table Records list with an icon link on each item to open an edit form for that item..
Each item also has a corresponding marker shown on a map. The marker has an on-click event that displays an info box on the map containing the various details for that item including an "Edit" link created in html text directly as "<a href=""MyEditForm.aspx?ItemId=" + MyTable.List.Current.Item.Id + """>Edit</a>"
This works perfectly and I can click on the grid item or the marker.Edit to open the edit page and edit the item detail.
Now I would like to change this scenario to use a popup form instead of opening on a new page.
It is easy enough to simply make the form a LayoutPopup form and add a RichWidgets\PopupEditor for the grid item but the problem comes with the marker's html which still opens the form as a normal page (not a popup) - It somehow needs the PopupEditor's magic.
I am not sure how the PopupEditor widget actually works but is there some way I can make the marker's html do the same as the grid icon's popup?
I thought I could create a single hidden popup link on the page and have the grid items and the marker html simply call it in an onclick event with the appropriate ID. Something like:
function MyEdit(id) {
var link = document.getElementById("HiddenLink");
link.setAttribute("href", "MyEditForm.aspx?ItemId=" + id);
link.click();
}
But then I got myself confused with what the link item should be holding in Destination and Method and oh dear - Just too tired now.
Any suggestions as to what path I should be taking to do what I want?
Regards,
Lester
In an attempt to explain this better by creating a simpler example I managed to solve my issue the way I originally tried.
The trick is as mentioned to create a standalone hidden link that does the popup and then call this via HTML created as:
SyntaxEditor Code Snippet
"<a href="#" onclick="callPopup(" + ListRecords1.List.Current.MyItem.Id + ", '" + linkHidden.Id + "'); return false;"">Edit</a>"
I needed to provide the runtime ID of the hidden link as a parameter and the "return false" ensures that the href link does not fire after onclick returns.
The callPopup function is created as javaScript in the main form as:
function callPopup(myItemId, linkId) { var link = document.getElementById(linkId); link.setAttribute("href", "MyPopupDetail.aspx?myItemId=" + myItemId); link.click(); }
Hi Lester.
If you could provide a sample, that would help. I would check the console for errors on your page. I expect that there is some type of JavaScript error because you are basically creating a popup on a popup. ie. the map in a pop up and then the marker would have a popup on that..
Stacey
Its not so much an issue of "something is not working", it is more "how do I go about it".
Its a bit too complex to provide a sample easily of the exact scenario but I'll see if I can't do an equivalent scenario.