Use Custom field renderer to popup skuid xml popup

  • 1
  • Question
  • Updated 4 years ago
So i am trying to use a custom field renderer to popup a skuid popup with details from the field 

this is what i have got so far i keep getting an error saying that i have an unexpected identifier

Uncaught SyntaxError: Unexpected identifier

with this error in the VM  skuid.utils.createPopupFromPopupXML('<popup width="80%" title="Viewing Details For Alan Unknown"><components><basicfieldeditor showheader="true" showsavecancel="false" model="CampaignMembers1" buttonposition="" mode="readonly" layout="above"><columns><column width="100%"><sections><section title="Section A" collapsible="no" showheader="false"><fields><field id="Form_response__c" showhelp="false" valuehalign="" type=""></field></fields></section></sections></column></columns><conditions><condition type="contextrow" field="Id" mergefield="Id" autocreated="true"></condition></conditions></basicfieldeditor></components></popup>',[object Object]).open();

Heres the code
var field = arguments[0], $ = skuid.$;
var popupXMLString ='&#39;<popup width=&quot;80%&quot; title=&quot;Viewing Details For {{{Contact.Name}}}&quot;>'
                         + '<components>'
                          + '<basicfieldeditor showheader=&quot;true&quot; showsavecancel=&quot;false&quot; model=&quot;CampaignMembers1&quot; buttonposition=&quot;&quot; mode=&quot;readonly&quot; layout=&quot;above&quot;>'
                          + '<columns>'
                            + '<column width=&quot;100%&quot;>'
                                + '<sections>'
                                    + '<section title=&quot;Section A&quot; collapsible=&quot;no&quot; showheader=&quot;false&quot;>'
                                        + '<fields>'
                                            + '<field id=&quot;Form_response__c&quot; showhelp=&quot;false&quot; valuehalign=&quot;&quot; type=&quot;&quot;/>'
                                           + '</fields>'
                                        + '</section>'
                                     + '</sections>'
                                  + '</column>'
                               + '</columns>'
                               + '<conditions>'
                                  + '<condition type=&quot;contextrow&quot; field=&quot;Id&quot; mergefield=&quot;Id&quot; autocreated=&quot;true&quot;/>'
                               + '</conditions>'
                            + '</basicfieldeditor>'
                         + '</components>'
                      + '</popup>&#39;';
var cellElem = field.element;
var context =  {
   row: field.row.Id
var log = "link pressed";
var javascript = "skuid.utils.createPopupFromPopupXML("+popupXMLString+","+field.row+").open();";
var link = '<a href="javascript:'+javascript+'">Show Notes</a>';
$( field.model.mergeRow( field.row, link ) ).appendTo( cellElem );
//var popup = skuid.utils.createPopupFromPopupXML(popupXML,context);
Photo of Yakup Kaygusuz

Yakup Kaygusuz

  • 130 Points 100 badge 2x thumb

Posted 4 years ago

  • 1
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,026 Points 5k badge 2x thumb
Hi Yakup,

Take a look at this tutorial Trigger popup from javascript?  Note that in this tutorial there is a line to convert the XML string into an XML document.

var popupXML = skuid.utils.makeXMLDoc(popupXMLString);
var popup = skuid.utils.createPopupFromPopupXML(popupXML,context);
This may be your problem.  Hope this gets you a little further.