velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marino A. Jonsson" <marino_jons...@hotmail.com>
Subject Re: Retrieve form elements from a velocity page
Date Wed, 29 Oct 2003 17:39:51 GMT
I am confused - do you populate the creationAdminOfForm before trying to
display it in the template?  Or are you having trouble displaying initial
form values?
Velocity has nothing to do with the actual html-form submission so if you
don't have trouble with populating the html-form from the form-bean then
your problem most likely lies with your Struts setup.

I can't see anything wrong with your example (at a glance).

cheers,
Marinó


<tkchris@netcourrier.com> wrote in message
news:mnet1.1067445823.15490.tkchris@netcourrier.com...
Hi,
I have recently started learning velocity. I am now trying to use it as the
view in my Struts application. But I am facing the following problem:
"retrieve data displayed in my form elements."

Elements used :
- creationAdminOfForm : the logical name of my FormBean as defined in my
struts-config.xml; I have tried $form.bean instead.

- siret : the property I am trying to retrieve the value in my Action.
the remaining parts are javascript formattings.

In my velocity page I write:
============================
<input name="siret" type="text" id="siret"
value="$!creationAdminOfForm.siret" size="17" maxlength="17"
onFocus="MM_changeProp('siret','','style.backgroundColor','yellow','INPUT/TE
XT')" onKeyUp="remplissage(this.value)"
onBlur="MM_changeProp('siret','','style.backgroundColor','#FFFFFF','INPUT/TE
XT');EstSiretValide(this.value)"></td>

In my action class I simply call :
==================================
public ActionForward execute(ActionMapping mapping, ActionForm anActionForm,
HttpServletRequest request, HttpServletResponse response) throws Exception {
        CAdminForm cAdminForm = (CAdminForm)Form;
        System.out.println("code : "+cAdminForm.getCode());
}


The form is well displayed but when I fill and submit, I have a surprising
result; nothing displayed!!! I try with other forms elements (checkBox,
select); the result is still the same.

Please tell me WHAT I AM MISSING HERE? Please tell me where I can find web
page examples formatted with velocity, containing form elements such as
checkBoxes, select, textField, etc...

Thanks



-------------------------------------------------------------
NetCourrier, votre bureau virtuel sur Internet : Mail, Agenda, Clubs,
Toolbar...
Web/Wap : www.netcourrier.com
Téléphone/Fax : 08 92 69 00 21 (0,34 ? TTC/min)
Minitel: 3615 NETCOURRIER (0,16 ? TTC/min)




---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message