(I'm not a programer, I have learned enough php to build my cms, but
that doesn't make me coding guru, so please excuse me if I'm asking
something trivail...)
well, I have one upload form where I want my users to choose category
for their picture. they are alowed to upload more then one picture at
time. and there is a problem. I have to use
<select name="name[$num]">
for my php script, so I have added id to the select tag
<select id="katSelector$num" name="name[$num"]>
so I can test if there is the same number of choosen category as the
number od pictures chossen for upload:
(whole php/javascript function:)
function validateCat()
{
<?
$uvjeti = "";
for ($num=0; $num<$brsl; $num++) {
$element = "$uvjeti(document.iduslike.katSelector$num.val ue == 0)";
if ($num < ($brsl - 1)) {
$uvjeti = "$element || ";
}
else {
$uvjeti = "$element";
}
}
echo"if ($uvjeti) {\n alert( \"just alert message\" );\n
window.event.returnValue = false;\n t}";
?>
}
in a case of 2 photos to upload, above functions create following code
in my page:
<script type="text/javascript">
<!--
function validateCat()
{
if ((document.iduslike.katSelector0.value == 0) ||
(document.iduslike.katSelector1.value == 0)) {
alert( "just alert message" );
window.event.returnValue = false;
}
}
//-->
</script>
and that works in Safari on my Mac, that works in IE on friends PC, but
that doesn't work on Firefox on any platform: I'm getting alert mesage,
but my upload function gets executed.
I have found that FF (and NN) doesn't understud:
window.event.returnValue = false;
It is now second day as I'm trying to find solution, but my knowlage of
js (and other variations) is so limited that I just can't go anmy
further...
please, can anyone help me?
here is whole form for case with just one photo to upload:
(trimed some irelevant lines)
(as seen in browser!)
<form name="iduslike" enctype="multipart/form-data" action=""
method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="153600">
<input name="userfile[0]" type="file">
<input type="text" name="slika_naziv[0]" size="20">
<select id="katSelector0" name="slika_kategorija[0]">
<option value="0">IZABERI KATEGORIJU!</option>
<option value="1">kategorija 1</option>
<option value="2">kategorija 2</option>
<option value="3">kategorija 3</option>
</select>
<input type="submit" value="upload" onClick="validateCat()">
<input type="reset">
</form>
--
Ja NE
http://fotozine.org/?omen=janimir
--