Kamna Jain wrote:
Hello Devs,
I am stuck again. I am trying to pass a value from a velocity template to an html form field on an XWiki page. How can I do this? Basically, I have a form in xwiki that has 2 buttons. One is of type button and a click on it displays the number of objects of a particular type in the input field beside it.
The second is a "Submit" button becuase I need to POST the value of a selected object from this form to the template. the template calculates some value and this value need to be filled in the input (number) filed on the form. How do I return the calculated value from the velocity template back to the xwiki page.
I tried $response.sendRedirect("url of that page", "name of html field = ${value calculated in the template}") but this does not work.
I don't fully understand what you want to do. Why redirect? Can't you just use <input value="$!{value}"... ? Isn't the HTML form in the same place where the script is?
I have questions regarding a few miscellaneous topics:
1) Watch List - Is there anything we need to add/modify in order for the Watch list notifications to work? -> I have the email ids in the user profile -> have 2 pages being watched -> the xwiki.cfg has the watchlistplugin and the mailsender plugin included -> I came across a watch.vm and watchlistrss.vm in the templates folder..but nothing for mail... -> also, in the menuview.vm, just where the Watch menu begins, there is a comment: We're disabling the Watchlist menu for now since the Watchlist doesn't work yet in multiwiki ## mode. Remove when http://jira.xwiki.org/jira/browse/XPWATCHLIST-4 is fixed. What is this for?
That comment is only for virtual (multiwiki) mode. If you are not in virtual mode, then watchlists should be working. If it isn't then make sure you have a sendmail server running (XWiki isn't a mailserver, so it must use something existing).
Please advice on how to get it to work.
2) We have noticed that every time a person logout of Xwiki and logs back in, Xwiki redirects the ser to the page where he hit the logout! This becomes an issue when a different user logs in on the same PC and he would expect to be redirected to the home page, but instead he is taken to some othe rpage.
In login.vm, replace: <div class="hidden"><input type="hidden" name="xredirect" value="$!request.xredirect" /></div> with: <div class="hidden"><input type="hidden" name="xredirect" value="$xwiki.getURL('Main.WebHome')" /></div>
-> Do I need to change anything here. What does $request.xredirect return? Please indicate which lines need to be altered/commented, so that users are always directed to home page when they log in.
-- Sergiu Dumitriu http://purl.org/net/sergiu/