Hi All
Still pushing against my limited javascript knowledge !!!!
I have a form where people can nominate themselves into one group or
another.......and I am saving the information in a tiddler using
slices -
the code -
<html><form name="grupos">
Grupo Vermelha <input type="text" name="nome[]"/> <input type="text"
name="nome[]"/> <input type="text" name="nome[]"/> <input
type="text" name="nome[]"/> <input type="text" name="nome[]"/><br>
Grupo Verde <input type="text" name="nome[]"/> <input type="text"
name="nome[]"/> <input type="text" name="nome[]"/> <input
type="text" name="nome[]"/> <input type="text" name="nome[]"/><br>
Grupo Azul <input type="text" name="nome[]"/> <input type="text"
name="nome[]"/> <input type="text" name="nome[]"/> <input
type="text" name="nome[]"/> <input type="text" name="nome[]"/><br>
Grupo Larangada <input type="text" name="nome[]"/> <input type="text"
name="nome[]"/> <input type="text" name="nome[]"/> <input
type="text" name="nome[]"/> <input type="text" name="nome[]"/><br>
Grupo Amarelha <input type="text" name="nome[]"/> <input type="text"
name="nome[]"/> <input type="text" name="nome[]"/> <input
type="text" name="nome[]"/> <input type="text" name="nome[]"/><br>
Grupo Marron <input type="text" name="nome[]"/> <input type="text"
name="nome[]"/> <input type="text" name="nome[]"/> <input
type="text" name="nome[]"/> <input type="text" name="nome[]"/><br>
<input type=button value="seleciona" onclick='
out="";
var m_nomes = document.grupos.elements["nome[]"];
for(i=0;i<m_nomes.length;i++)
{
var slice ="|"+i+"|"+m_nomes[i].value+"|\n";
out+=slice;
}
var title="Grupos";
var when=new Date();
var who=localStorage.username;
var tags="grupos "+localStorage.curso;
store.saveTiddler(title,title,out,who,when,tags,null);
autoSaveChanges();
story.displayTiddler(null,title);
'>
OK thats working.....
now when another student comes to fill in their name....I need to pass
the previously stored information back into the html form...so they
can see which positions are taken and which available.....
back in jan 2011 Eric helped me with a similar situation (Accessing
script variables in html form? ) except that back then the form and
array only had a few elements...I now have potentially over 40 input
boxes in the html form.
OK after that code above I am trying to do something like -
<script>
var form=place.lastChild.getElementsByTagName('form')[0];
var length=place.lastChild.getElementsByTagName('form').length;
alert(length);
for(t=0;t<length;t++){
form.nome[t].value=store.getTiddlerSlice("Grupos",t);
}
</script>
Seems I have two main problems......the calculation of the array
length is not working.....
and the main line where I put the values back into the array
"nome"...... Note that the slices stored above are stored simply in
the format
|0|name0|
|1|name1|
|2|name2|....
Hope someone can correct that last bit of code for me.
Thanks in Advance
Skye
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tiddlywiki?hl=en.