I've recently been working on the document editor component and needed the option to select from stack of tags depending on the document someone is editing. I copied the documentEditor form over from the cloud sample solution and put all the tagbuilder code in the initEditor method in a switch/if statement and it no longer worked. Everything I try just doesn't seem to make any difference and I have no idea what is causing this or how it can be fixed. When the tagbuilder code is outside of the switch/if statement it works perfectly and I'm able to use the tags in the document editor.
Here is my code:
- Code: Select all
function initEditor(){
// getInstance
docEditor = scopes.svyDocEditor.getInstance(elements.smartDoc);
if (formTag == null) {
return;
}
application.setValueListItems("documentEditorTags", null);
// POPULATE THE TAG FIELDS LIST
if (formTag == 'customer_order') {
var tagBuilder = docEditor.tagBuilder(datasources.db.data.orders.getDataSource());
tagBuilder.addField('order_number');
tagBuilder.addField('date_order', 'Order Date');
tagBuilder.addField('shippeddate', 'Shipped Date');
tagBuilder.addField('displayAddress', 'Address');
tagBuilder.addField('orderStatus', 'Status');
tagBuilder.addField('order_total', 'Total');
tagBuilder.addField('orders_to_contacts.business', 'contacts.Company', false);
tagBuilder.addField('orders_to_order_items.product_quantity', 'OrderItems.Quantity');
tagBuilder.addField('orders_to_order_items.product_price', 'OrderItems.Unit Price');
tagBuilder.addField('orders_to_order_items.subtotal', 'OrderItems.Subtotal');
tagBuilder.addField('orders_to_order_items.product_make', 'Product.Make', false);
tagBuilder.addField('orders_to_order_items.product_model', 'Product.Model', false);
tagBuilder.build();
application.setValueListItems("documentEditorTags", tagBuilder.getFields());
}
}
The code inside the switch/if statement is still being called and is producing errors for some of the tags I haven't yet set up, and no other errors are popping up about the problem.
Thanks!
Alasdair