• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Problem with a Form

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the second table is in the form and within form tags
so it is not a problem of javascript??
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it just a table or does the table contain form elements??
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes. it's ok
 
If you are using a wood chipper, you are doing it wrong. Even on this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic