Z
Zvonko
Hi! T
This is the code:
<script type="text/javascript">
function Provjeri(i) {
var poruka = "";
if (i.ime.value=="") {
poruka+="* Nedostaje Ime i Prezime!\n";
i.ime.style.backgroundColor="FFDDDD";
}
else {
i.ime.style.backgroundColor="293B42";
}
if (i.username.value=="") {
poruka+="* Nedostaje Username!\n";
i.username.style.backgroundColor="FFDDDD";
}
else {
i.username.style.backgroundColor="293B42";
}
if (poruka!="") {
alert("Niste unijeli sve potrebne podatke:\n" + poruka);
return false;
}
else {
return true;
}
}
</script>
And this is HTML form:
<form action="unos_reg.jsp" method="POST" name="forma" id="forma">
<table id="tablica">
<tr>
<td align="left">
<strong>Ime i Prezime:<font color="yellow">*</font></strong>
</strong>
</td>
<td>
<input class="polje1" type="text" name="ime" id="ime"/>
</td>
</tr>
<tr>
<td align="left">
<strong> KorisniÄko ime:
<font color="yellow">*</font>
</strong>
</td>
<td>
<input class="polje1" type="text" name="username"
id="username"/>
</td>
</tr>
<td align="center">
<input class="gumb" type="submit" name="submit"
onclick="Provjeri(forma);" value="Registriraj se!"/>
</td>
Don't look at table tags, its just a segment of code.
I have two questions:
1. Everything works fine, form is validated, pop up is returned, but
after clicking OK on popup window, the page is redirected to
unos_reg.jsp. Why? It should stay on this page and wait for the form to
be corected! Any ideas?
2. In FireFox after validation text areas remain the same color (the
color is not changed!?)
Thanks
Zvonko
This is the code:
<script type="text/javascript">
function Provjeri(i) {
var poruka = "";
if (i.ime.value=="") {
poruka+="* Nedostaje Ime i Prezime!\n";
i.ime.style.backgroundColor="FFDDDD";
}
else {
i.ime.style.backgroundColor="293B42";
}
if (i.username.value=="") {
poruka+="* Nedostaje Username!\n";
i.username.style.backgroundColor="FFDDDD";
}
else {
i.username.style.backgroundColor="293B42";
}
if (poruka!="") {
alert("Niste unijeli sve potrebne podatke:\n" + poruka);
return false;
}
else {
return true;
}
}
</script>
And this is HTML form:
<form action="unos_reg.jsp" method="POST" name="forma" id="forma">
<table id="tablica">
<tr>
<td align="left">
<strong>Ime i Prezime:<font color="yellow">*</font></strong>
</strong>
</td>
<td>
<input class="polje1" type="text" name="ime" id="ime"/>
</td>
</tr>
<tr>
<td align="left">
<strong> KorisniÄko ime:
<font color="yellow">*</font>
</strong>
</td>
<td>
<input class="polje1" type="text" name="username"
id="username"/>
</td>
</tr>
<td align="center">
<input class="gumb" type="submit" name="submit"
onclick="Provjeri(forma);" value="Registriraj se!"/>
</td>
Don't look at table tags, its just a segment of code.
I have two questions:
1. Everything works fine, form is validated, pop up is returned, but
after clicking OK on popup window, the page is redirected to
unos_reg.jsp. Why? It should stay on this page and wait for the form to
be corected! Any ideas?
2. In FireFox after validation text areas remain the same color (the
color is not changed!?)
Thanks
Zvonko