postHandler ate my variables!!!!


I don’t know if this is my misunderstanding of how this works or whether this a bug but I’ve got a strange thing happening in one of the handlers of my new Module.

Code for the handler is this…

var rc = event.getCollection();

// Call SITS LookupService - this is coming from the parent factory, declared within the EnrolNow project.
rc.objIterator = getPlugin(‘ioc’).getBean(‘SITSLookupListService’).getLookupListInfo(‘domicile’);

// Postcode search button view & properties
rc.QAS_labelID = ‘Country’;
rc.QAS_tableID = ‘QAS_country’;
rc.QAS_labelTitle = ‘country’;
rc.QAS_displayHolder = renderView(view=’#rc.viewPrefix#/dropdownResult’,module=rc.QASSettings.title);

// Push into the table template and return the HTML

… and I have a postHandler that looks like this…

var rc = event.getCollection(); var i = 1; var deleteLst = "objQAS,objQASService,postCodeSearchBtn,QAS_DisplayHolder1,QAS_labelID,QAS_labelTitle,"; deleteLst &= "QAS_selectID,QAS_style,QAS_tableID,viewPrefix";

// Clean up the variables we don’t want going back into the request collection of the calling application

If I’m following correctly, I think the confusion is that event.setView() doesn’t actually render the view right then. It simply tells the event what view to render at a later date. Unfortunately, that later date is after your post handler.

If you want to render the view absolutely right then, look into the event’s renderView() method to generate the HTML of the view right then into a variable for you to return.
Along those lines, event.renderData() is also worth reading about if you are wanting to return data directly to an Ajax call without a view.



Sorry, I meant to include this link. It talks about both of those methods.