Dynamically creating XForms
I have the following setup:
1) a table tblhomepageitems (key: hpi_id)
with a list of XForms that users may select
to place on their homepage (dashboard)
hpi_xform contains the STRING with the
name of the xform
2) a table tblhomepage (key: hpg_id) that
contains the XForms that a specific user
has selected:
hpg_med_id <-- reference to user table
hpg_hpi_id <-- reference to specific item
hpg_column <-- in what column do you want it
hpg_sort <-- sorting within the column
3) a table tblmedewerker (key: med_id) that
contains the users:
med_username
med_password
(so what AG calls a userid is actually
stored in med_username)
How do I get this done?
Eljakim
Does this example help? You
Does this example help?
You need to run it in 2.3, there is a bug in 2.2.x that wont let it run.
There is also an API call,
runtime.getWebService().invokeOperation("myPageName","myPageName","default",None,None)
which will let you invoke a page from code.
geremy
--
Geremy Cohen
Community Dev Manager
ActiveGrid, Incorporated
150 Spear Street, Suite 525
San Francisco, California 94105
I tried running it in 2.3
I tried running it in 2.3 (RC2, clean install) and get the following:
Mod_python error: "PythonHandler mpidehandler"
Traceback (most recent call last):
File "C:\Program Files\ActiveGrid Studio\3rdparty\python24\lib\site-packages\mod_python\apache.py", line 299, in HandlerDispatch
result = object(req)
File "C:\Program Files\ActiveGrid Studio\prod\python\mpidehandler.py", line 176, in handler
ret=_handler(req)
File "C:\Program Files\ActiveGrid Studio\prod\python\mpidehandler.py", line 170, in _handler
ret=modpythonhandler.handler(req)
File "C:\Program Files\ActiveGrid Studio\prod\python\activegrid\server\modpythonhandler.py", line 143, in handler
ctx = ModPythonContext(req, dplName)
File "C:\Program Files\ActiveGrid Studio\prod\python\activegrid\server\modpythonhandler.py", line 247, in __init__
params, path)
File "C:\Program Files\ActiveGrid Studio\prod\python\activegrid\server\runtimesupport.py", line 1570, in __init__
isTestMode=isTestMode)
File "C:\Program Files\ActiveGrid Studio\prod\python\activegrid\server\runtimesupport.py", line 666, in __init__
self.dataServiceMgr = findDataServiceMgr(self.processModelName, preview=self.isPreviewMode)
File "C:\Program Files\ActiveGrid Studio\prod\python\activegrid\server\runtimesupport.py", line 499, in findDataServiceMgr
raise errors
ConfigurationErrors: ERROR: Cannot find file 'C:\Program Files\ActiveGrid Studio23release\prod\python\static\kbheader.lyt', in layoutref, file C:\Documents and Settings\eljakim\Bureaublad\dropdownpage\dropdownpage.tmp.dpl
ERROR: Cannot find file 'C:\Program Files\ActiveGrid Studio23release\prod\layouts\kbfooter.lyt', in layoutref, file C:\Documents and Settings\eljakim\Bureaublad\dropdownpage\dropdownpage.tmp.dpl
Oops, sorry. Close the
Oops, sorry. Close the studio, edit the agp by hand, and delete the lines:
<ag:file filePath="C:\Program Files\ActiveGrid Studio23release\prod\python\static\kbheader.lyt" logicalFolder="Presentation/Layouts" type="layout"/>
<ag:file filePath="C:\Program Files\ActiveGrid Studio23release\prod\layouts\kbfooter.lyt" logicalFolder="Presentation/Layouts" type="layout"/>
geremy
This is not really what we
This is not really what we meant. You're not invoking the different pages from code! Right now there is an action that has different endpoints with the name of the service hard coded in the action. We know how to do that.
Our question has the NAME of the xform in the database, so there are no names hard coded in actions.
To follow your example: could you change the action so that there are NO xform names or service names hardcoded, but instead something is done along
invoke(message/selectedPart)
Eljakim
Ok, check out the following
Ok, check out the following attached invokeByPage.zip.
A page name is defined in an XForm Msg Part, and based on which Msg Part the button is referencing, AG will programatically invoke that XForm.
Tell me if this is more of what you are looking for.
Be sure to unzip to a seperate dir than dropdownpage.zip, I reused and renamed files cuz I was lazy ;)
--
Geremy Cohen
Community Dev Manager
ActiveGrid, Incorporated
150 Spear Street, Suite 525
San Francisco, California 94105
It's still not really what
It's still not really what we want to see.
What we would like in the example is:
* Text input: 'select pages you want to see, seperated by comma'
* Turn this string into a list of pages
* Have a vertical layout that iterates over this list of pages
* In the vertical layout have an iFrame that shows the selected page.
So the screen would basically look as follows:
Select pages: [ p1,p1,p2,p1 ]
{OK button}
-------
p1
p1
p2
p1
Does this make sense?
Eljakim
Oh - and just so you know
Oh - and just so you know what we expect the including XForm to look like:
* Text Input
* Button
* Vertical Layout: Pages
\-* AjaxFrame: ./Page
It would be great if we can avoid having several nested AjaxFrames; so one ajaxframe per page would be best.
We're definitely looking forward to your answer!
Eljakim