On 9/21/06, Heidy Gutiérrez Guzmán <[EMAIL PROTECTED]> wrote:
Hi I need to put value to an input hidden field, from a java script function. I call the java script function from an onclick event of html:submit field I have debuged that process and input hidden field does'nt take value. Always have the default value. This is my way to do this *******This is the java script function********* <script language="JavaScript"> function actualizarCampoOcultoRest(forma, campo, valor) { document.forma.campo.value = valor; } </script> **********This is the call to the function java script******************** <html:submit styleClass="botones" property="btnEdicion" onclick="actualizarCampoOcultoRest(gestionarListadoMonitoresEDHEPForm, campoOcultoRestablecer, '1');">
The problem is here, this is a javascript error. Your method of sending the form name and parameter name is incorrect. You should probably try and send the id of your hidden field and do the following function setAndSubmit(paramId,paramValue) { document.getElementById(paramId).value = paramValue } You can specify the id this way <html:hidden property="foo" styleId="hiddenId" /> <html:submit onclick="setAndSubmit('hiddenId','value')" /> <logic:present name="idSeleccionado" scope="session"><bean:message key=
"boton.Actualizar"/></logic:present> <logic:notPresent name="idSeleccionado" scope="session"><bean:message key="boton.Insertar"/></logic:notPresent> </html:submit> *********This is the input field*********** <html:hidden property="campoOcultoRestablecer"/> *******In the ActionForm class i declared the input field like this:****** private int campoOcultoRestablecer; Always have the default value, 0 if anybody could help me... Thanks
-- Puneet