on 04-14-2006 7:33 AM
Hello everybody!
There is an XML form (created in XML Forms Builder). I need to create/edit xml files using this form, in the same way as I can do it in the Portal.
I have some code, which should solve my problem, but it isn't work:
IURLGeneratorService generatorService = (IURLGeneratorService) ResourceFactory.getInstance().
getServiceFactory().getService("URLGeneratorService");
IUriReference reference = generatorService.getRelativeUri(PathKey.XML_FORMS_EDIT_PAGE);
UriQuery query = new UriQuery();
query.add("XMLFormID", "btexx_quicknotes");
reference = reference.setQuery(query.toExternalForm());
response.write("<a href="" + reference.toExternalForm() + "" >link</a><br>n");
It opens my XML form, but after clicking save button it rises exception:
Cannot read item b0c02216-adad-2810-3180-f457b90bace4.xml
com.sapportals.wcm.repository.InvalidUriException: Invalid RID: b0c02216-adad-2810-3180-f457b90bace4.xml
at com.sapportals.wcm.repository.ResourceException.fillInStackTrace(ResourceException.java:399)
I suppose that there are some other necessary parameters for XML editor, but I dont know where I can get it.
Does anyone know how to solve my problem?
Hi Egor,
it's really easy to get an idea about what's needed - just check the URL called from the Folder -> New -> Forms -> [Form] command:
To create (that seems what you are trying here):
http://[server]/irj/servlet/prt/portal/prtroot/com.sap.km.cm.xmlformedit?XMLFormID=[form_name]&post/... of the folder where the doc will be created]&createmode=true
- so you missed the post/path parameter.
To edit:
http://[server]/irj/servlet/prt/portal/prtroot/com.sap.km.cm.xmlformedit?XMLFormID=&show/test=[path of the xml to be edited]
Hope it helps
Detlev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks a lot for your answer, it was really helpful.
But I forgot about another problem. During new xmlfile-creation I need to pass initial values for some fields. It's like edit mode but for new xmlfile. Is it possible?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Egor,
this is not possible dynamically. But you can define (static) default values for your input fields etc. within the XMLForm(Builder).
If you need such a dynamic mechanism, you could create a concrete instance of an XML file programtically (for instance, by copying an empty template you have created before) and then set the corresponding property dynamically before editing this newly created form instance.
Hope it helps
Detlev
PS: Please consider rewarding helpful answers...
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.