Hi again,
We are trying to figure out how to validate the form field values in XWiki.
For example, if we have a form like this:
<html>
<form name="feedback" action="" method="post"
onSubmit="return checkform()">
<input type="text" name="name">
<input type="text" name="email" value="xyz">
<textarea name="feed"></textarea>
<input type="submit" value="Submit" />
</form>
how do we check that none of the fields are left blank, valid characters
etc...
1) Can we use Javascript? If yes, is there a special macro to embed
javascript in xwiki editor?
2)I guess this question goes back to the $msg construct. Is there a msg that
I can display if any fields have wrong values?
Also, when I tried:
<html>
<form name="feedback" action="" method="post"
onSubmit="return checkform()">
<input type="text" name="name">
<input type="text" name="email" value="xyz">
<textarea name="feed"></textarea>
<input type="submit" value="Submit" />
# set($name = $request.getParameter("name"))
# set($email= $request.getParameter("email"))
# set($feed= $request.getParameter("feed"))
</form>
The name is $name
the velocity statements just printed as is on the page..the # being
interpreted as 1, 2, 3.
Why did this happen?
Thanks