The Ajax Suggest will retrieve pairs of (document name => person
pretty name). The suggest will display the right side of the pair, but
this is not the field that gets submitted. Another JavaScript will
fill in the actual (hidden) input with the left side of the selected
pair.
So the HTML code will be:
<input id="inputSuggest$velocityCount" alt="Suggestions"
type="text"
onchange="this.form.inputSubmit${velocityCount}.value=findMatch(this.value);"/>
<input id="inputSubmit$velocityCount"
name="inputSuggest$velocityCount" type="hidden" />
And the findMatch function will search inside the retrieved pairs.
On 5/10/07, evelyne24(a)gmail.com <evelyne24(a)gmail.com> wrote:
Well, thank you for the responses on my previous
posts.
Another "difficult" question (for me :( )...
Here is the code:
#foreach($obj in $doc.getObjects("Movr.MediaHasPersonClass"))
#if($context.action=='view')
#set($personObj=
$xwiki.getDocument($obj.getProperty('person').value).getObject("Movr.PersonClass"))
##link to person's page
#set($personURL =
$xwiki.getURL("$obj.getProperty('person').value"))
<a href="$personURL">$personObj.firstName
$personObj.lastName</a>
#else ###inline
##ajax input suggest
<input id="inputSuggest$velocityCount" name="inputSuggest"
alt="Suggestions" type="text" />
$obj.person
The question is the following one: I have an Ajax input suggest (which works just fine,
it retrieves from the database the information I need), which is suppose to help me add
another object of type PersonClass, by selecting from the ones that are already in the
database. My class MediaHasPersonClass has a field person, of type DatabaseList, which
initially had attached a Hibernate query to retrieve all the persons from the database and
display them in a select. Now, I'm using this Ajax suggest so I would like to somehow
tell xwiki that the person whom I selected from the suggest is the correspondent object
(for instance, if I write $obj.person I get an xwiki rendered input with the name of a
person from the database, and if I change the name and save it, the modifications will be
kept).
I would like to know how can I do that for my own input.
I hope I explained somehow what I would like to know...
Thanks.
Evelina
Sergiu
--
http://purl.org/net/sergiu