aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Problem with a Form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem with a Form" Watch "Problem with a Form" New topic
Author

Problem with a Form

Miguel Flecha
Ranch Hand

Joined: Jun 23, 2004
Posts: 85
Hi all. I'm using this Javascript code to move elementes among 2 tables.
The problem is that I want to submit the content of the second table, which is an array, but when I get the content of the form that field is null.
What am I doing wrong? This is the code...


<script language="JavaScript">
var proyecto;
var truncado=0;
function openWindow() {
var url = "/defaultroot/buscarproyecto.do";
window.open(url,'buscar_proyecto','width=400,height=400,top=134,left=262,resizable=1,scrollbars=1');
}
function actualizar(){
proyecto=notificar.projectId.value;
var url="/defaultroot/prenotificar.do?projectId="+proyecto;
window.navigate(url);
}
function codigoSeleccionado(codigo){
if(codigo!=""){
if(document.notificar.projectId.options[0]!=""){
truncado=1;
}

if(truncado==0){var opciones=document.notificar.projectId.options;
document.notificar.projectId.options[0].text=codigo;
document.notificar.projectId.options[0].value=codigo;
for (i = 1; i < opciones.length ; i++){
if ((opciones[i].value==codigo)&&(i!= (opciones.length-1))){
for (j = i;j<opciones.length;j++){document.notificar.projectId.options[j]=opciones[j+1];
truncado=1;
}
break;
}
}
document.notificar.projectId.options[opciones.length-1]=null;
document.notificar.projectId.options.length--;
}else{
var opcion=document.notificar.projectId.options[0];
var opciones=document.notificar.projectId.options;
document.notificar.projectId.options[0].text=codigo;
document.notificar.projectId.options[0].value=codigo;
for (i = 1; i < opciones.length ; i++){
if(opciones[i].value==codigo){
document.notificar.projectId.options[i]=opcion;
break;
}
}
}
}
}

</script>

Thanks!

[ Tried to add code tags but it made it look worse - Eric ]
[ August 25, 2004: Message edited by: Eric Pascarello ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Originally posted by Miguel Flecha:
Hi all. I'm using this Javascript code to move elementes among 2 tables.
The problem is that I want to submit the content of the second table, which is an array, but when I get the content of the form that field is null.
What am I doing wrong? This is the code...


First off When you say second table not submitting, I am assuming that the second table contains form elements that are being submitted. Second, is the second table within the form tags, if it is not, the elements are not included.

I am not sure what that code has to do with the submission problem. If that last part of the code that is not included in a function is not running, then you need to mkae that a function and call it onload.

Eric
Miguel Flecha
Ranch Hand

Joined: Jun 23, 2004
Posts: 85
the second table is in the form and within form tags
so it is not a problem of javascript??
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Is it just a table or does the table contain form elements??
Miguel Flecha
Ranch Hand

Joined: Jun 23, 2004
Posts: 85
it is a table with form elements, and one of them is an array containing the information that is not submitting correctly
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Before I look into the code, is the array in the form element correctly before the page is being submitted?

If the element is hidden then you can view it by typing

javascript:alert(document.formName.elementName.value)

into the address bar
Miguel Flecha
Ranch Hand

Joined: Jun 23, 2004
Posts: 85
yes. it's ok
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with a Form