maracucho
asked on
Problems with form request, generated by InnerHTML (JavaScript) in a JSP page
Hi Guys, i got a problem sending a form, generated dinamically by a InnerHTML.
The problem is: i generate some input textfields with this function (its working very well), but this parameters cant pass throw the request form (i cant catch nothing in the action page). I try in plain html without a problem, i think its a JSP problem.
I appreciate a little help... thanks!
The problem is: i generate some input textfields with this function (its working very well), but this parameters cant pass throw the request form (i cant catch nothing in the action page). I try in plain html without a problem, i think its a JSP problem.
I appreciate a little help... thanks!
you said you have no problem with html, then rename you foo.html to foo.jsp, is it still work? if yes, then start to modify you foo.jsp by adding dynamic information. and then at the browser side, use view source to see if you get the same html source?
ASKER
thanks guys,and... about my code,
check it out:
...
<script LANGUAGE = "JavaScript">
function ponerPreguntas(i) {
if(i != null) {
var preguntas = '';
for(var j=0; j<i; j++)
{
preguntas += '<tr><td>Opcion ' + (j+1) + ': <input type=text name=opcion' + (j+1) + '></td></tr>';
}
document.getElementById("p reguntas") .innerHTML = preguntas;
...blahblah...
</script>
...
<form name="crearencuesta" method="POST" action="encuestaCreada.jsp ">
...<table id="preguntas">
...
<input type="submit" name="Submit" value="Enviar">
</form>
...
and, about encuestaCreada.jsp:
<%
...
Enumeration paramNames = request.getParameterNames( );
while (paramNames.hasMoreElement s())
{
String currentName = (String)paramNames.nextEle ment();
String currentValue = request.getParameter(curre ntName);
System.out.println(current Name + " = " + currentValue);
}
...
%>
Sorry about my spanish...Thankyou again...
P.D. I worked in the same way you said kennethxu, prior post my question. I dont know how, but the html version works (even with cgi-perl) without modify the source view. Actually, im using Netscape 6 for linux.
check it out:
...
<script LANGUAGE = "JavaScript">
function ponerPreguntas(i) {
if(i != null) {
var preguntas = '';
for(var j=0; j<i; j++)
{
preguntas += '<tr><td>Opcion ' + (j+1) + ': <input type=text name=opcion' + (j+1) + '></td></tr>';
}
document.getElementById("p
...blahblah...
</script>
...
<form name="crearencuesta" method="POST" action="encuestaCreada.jsp
...<table id="preguntas">
...
<input type="submit" name="Submit" value="Enviar">
</form>
...
and, about encuestaCreada.jsp:
<%
...
Enumeration paramNames = request.getParameterNames(
while (paramNames.hasMoreElement
{
String currentName = (String)paramNames.nextEle
String currentValue = request.getParameter(curre
System.out.println(current
}
...
%>
Sorry about my spanish...Thankyou again...
P.D. I worked in the same way you said kennethxu, prior post my question. I dont know how, but the html version works (even with cgi-perl) without modify the source view. Actually, im using Netscape 6 for linux.
Make action="GET", and check what parameter name and value do see in the URL, after testing it,you can change it back to "POST", this is just to check param names and their values.
If you are getting those params in URL, then you can see in the server log about error may have occurred in encuestaCreada.jsp.
If you still can'nt resolve this ? Could you post us your entire jsp codes for both jsps ?
If you are getting those params in URL, then you can see in the server log about error may have occurred in encuestaCreada.jsp.
If you still can'nt resolve this ? Could you post us your entire jsp codes for both jsps ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you could post your code..then someone can possibly help you.
regards
fargo