Hi,
I am developing a script to add new entries into a datatable after the editor picked items from a checkbox list.
I made the form but how can i store those selections into the datatable?
Thanks
| // get the master language |
LanguageAgent languageAgent = context.requireSpecialist(LanguageAgent.TYPE);
Language lang = languageAgent.getMasterLanguage();
// get the ContentStore-element
storeElementAgent = context.requireSpecialist(StoreElementAgent.TYPE);
newsTargetTable = storeElementAgent.loadStoreElement(NEWSTARGETSTABLE,IDProvider.UidType.CONTENTSTORE,false);
// get the datasource schema and a session
session = newsTargetTable.getSchema().getSession();
// create result query
select = session.createSelect(newsTargetTable.getEntityType().getName());
entityList = session.executeQuery(select);
//retrieve all entitites
uidEq = new Equal("news_editorsList.uid",user.getLoginName());
select.setConstraint(uidEq);
EntityList entityList = session.executeQuery(select);
// construction of gui /////////////////////////////////
gui = new StringBuffer();
gui.append("<CMS_MODULE>");
gui.append("<CMS_INPUT_CHECKBOX name=\"cs_target\" label=\"Target\" hfill=\"yes\">");
gui.append("<ENTRIES>");
//create gui content - iterate over foreign keys
for (entity : entityList) {
| // ... |
| |
| target = entity.getValue("fs_id"); |
| gui.append("<ENTRY value=\"" + target + "\">"); |
| gui.append("<LANGINFOS><LANGINFO lang=\"*\" label=\"" + target + " | " + company + " | " + type + " | " + location + "\" /></LANGINFOS>"); |
| gui.append("</ENTRY>"); | |
}
gui.append("</ENTRIES></CMS_INPUT_CHECKBOX>");
gui.append("</CMS_MODULE>");
// construction of gui end /////////////////////////////
// get a FormsAgent for creating a form from XML
formsAgent=context.requireSpecialist(FormsAgent.TYPE);
form=formsAgent.getForm(gui.toString());
// get an OperationAgent
opAgent=context.requireSpecialist(OperationAgent.TYPE);
// aquire a ShowFormDialogOperation and configure it
displayFormOp=opAgent.getOperation(ShowFormDialogOperation.TYPE);
displayFormOp.setOkText("Weiter");
// open the form. It will return a FormData
formData = displayFormOp.perform(form,Arrays.asList(lang));
if(formData != null) {
| // how to store selected items in NEWSTARGETSTABLE? |
| // ... |