Hi,
I have an object (Intranet.AbCompany) where I would like to insert a
relation to objects of type Intranet.AbPerson
Does "display type input" allow to display one field and submit a
different field (I mean to work in the same way select list does)?
This is useful because if you have 1000 or more values select is not
practical and the only solution is an input box with suggest. In this
scenario, I need to display the person surname, but store the related
object id (my use case is an internal address book, where you need to
connect company and person)
Thank you,
Gianluca
------- Note, settings an errors ------------------------
Settings:
- multiple objects are stored in a single page
- field type is "database list"
- multiple select, relational storage, suggest are all checked
- If display type is select it works well
- if display type is input, the suggest ajax call throw an exception
- Hibernate query used:
SELECT pval.value, pid.value FROM BaseObject obj, StringProperty
pval, StringProperty pid WHERE obj.className='Intranet.AbPersonClass'
AND obj.name <> 'Intranet.AbPersonTemplate' AND pval.id.id = obj.id
AND pval.id.name = 'surname' AND pid.id.id = obj.id AND pid.id.name =
'name'
- ajax exception:
Request URL:http://....../xwiki/bin/view/Main/WebHome?
xpage
=suggest&classname=Intranet.AbCompanyClass&fieldname=person&firCol=-
&secCol=-&input=gianl
Request Method:GET
Status Code:200 OK
1 requests ❘ 9.92KB transferred
WebHome
/xwiki/bin/view/Main
HeadersContentCookiesTiming
<a href=""
onclick="document.getElementById('xwikierror1').style.display='block';
return false;">Error number 4001 in 4: Error while parsing velocity
page /templates/suggest.vm
Wrapped Exception: Failed to evaluate content with id [/templates/
suggest.vm]<div id="xwikierror1" style="display: none;"><pre
class="xwikierror">
Error number 4001 in 4: Error while parsing velocity page /templates/
suggest.vm
Wrapped Exception: Failed to evaluate content with id [/templates/
suggest.vm]
com.xpn.xwiki.XWikiException: Error number 4001 in 4: Error while
parsing velocity page /templates/suggest.vm
Wrapped Exception: Failed to evaluate content with id [/templates/
suggest.vm]
at
com
.xpn
.xwiki
.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:122)
at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1840)
at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:153)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:224)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
at
org
.apache
.struts
.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at
org
.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
236)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:129)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org
.xwiki
.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:
152)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com
.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org
.xwiki
.container
.servlet
.filters
.internal
.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:
218)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org
.xwiki
.container
.servlet
.filters
.internal
.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:
112)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at
org
.mortbay
.jetty
.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:
230)
at
org
.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:
114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
at org.mortbay.jetty.HttpConnection
$RequestHandler.headerComplete(HttpConnection.java:915)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
at
org
.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)
Wrapped Exception:
org.apache.velocity.exception.MethodInvocationException: Invocation of
method 'search' in class com.xpn.xwiki.api.XWiki threw exception
com.xpn.xwiki.XWikiException: Error number 3223 in 3: Exception while
searching documents with sql SELECT pval.value, pid.value FROM
BaseObject obj, StringProperty pval, StringProperty pid WHERE lower()
like ? and obj.className='Intranet.AbPersonClass' AND obj.name <>
'Intranet.AbPersonTemplate' AND pval.id.id = obj.id AND pval.id.name =
'surname' AND pid.id.id = obj.id AND pid.id.name = 'name'
Wrapped Exception: could not execute query at /templates/
suggest.vm[line 44, column 26]
at
org
.apache
.velocity
.runtime
.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243)
at
org
.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:
187)
at
org
.apache
.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:
280)
at
org
.apache
.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567)
at
org
.apache
.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
at
org
.apache
.velocity
.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:
72)
at
org
.apache
.velocity
.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
at
org
.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:
342)
at
org
.xwiki
.velocity
.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:195)
at
org
.xwiki
.velocity
.internal.DefaultVelocityEngine.evaluate(DefaultVelocityEngine.java:160)
at
com
.xpn
.xwiki
.render.XWikiVelocityRenderer.evaluate(XWikiVelocityRenderer.java:116)
at com.xpn.xwiki.XWiki.evaluateTemplate(XWiki.java:1840)
at com.xpn.xwiki.web.Utils.parseTemplate(Utils.java:153)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:224)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
at
org
.apache
.struts
.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at
org
.apache.struts.action.RequestProcessor.process(RequestProcessor.java:
236)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1166)
at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:129)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org
.xwiki
.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:
152)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
com
.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org
.xwiki
.container
.servlet
.filters
.internal
.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:
218)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org
.xwiki
.container
.servlet
.filters
.internal
.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:
112)
at org.mortbay.jetty.servlet.ServletHandler
$CachedChain.doFilter(ServletHandler.java:1157)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:
216)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at
org
.mortbay
.jetty
.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:
230)
at
org
.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:
114)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:536)
at org.mortbay.jetty.HttpConnection
$RequestHandler.headerComplete(HttpConnection.java:915)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:405)
at
org
.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
409)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.xpn.xwiki.XWikiException: Error number 3223 in 3:
Exception while searching documents with sql SELECT pval.value,
pid.value FROM BaseObject obj, StringProperty pval, StringProperty pid
WHERE lower() like ? and obj.className='Intranet.AbPersonClass' AND
obj.name <> 'Intranet.AbPersonTemplate' AND pval.id.id = obj.id AND
pval.id.name = 'surname' AND pid.id.id = obj.id AND pid.id.name = 'name'
Wrapped Exception: could not execute query
at
com
.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:
2162)
at
com
.xpn.xwiki.store.XWikiHibernateStore.search(XWikiHibernateStore.java:
2094)
at
com.xpn.xwiki.store.XWikiCacheStore.search(XWikiCacheStore.java:689)
at com.xpn.xwiki.api.XWiki.search(XWiki.java:556)
at sun.reflect.GeneratedMethodAccessor444.invoke(Unknown Source)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.apache.velocity.util.introspection.UberspectImpl
$VelMethodImpl.doInvoke(UberspectImpl.java:395)
at org.apache.velocity.util.introspection.UberspectImpl
$VelMethodImpl.invoke(UberspectImpl.java:384)
at
org
.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:
173)
... 48 more