![]() |
![]() ![]() |
![]() |
![]() ![]()
Post
#1
|
|
![]() Grupa: Zarejestrowani Postów: 41 Pomógł: 0 Dołączył: 30.05.2003 Ostrzeżenie: (0%) ![]() ![]() |
mama pole
Kod <input type="file" name="uploadedfiles[1]"> i chciałbyn sprawdzić czy user wybrał plik do przesłania na serwer za ponocą java.mam warunek w funkcji check() Kod if (document.uploaddoc.uploadedfiles[1].checked == false) { gdzie uploadodc jest nazwą formularza do wysyłania. oczywiście warunek nie sprawdza i pozwala userowi na dokonanie uploud'ualert("Proszę wybrać chociaż jeden plik do przesłania") document.uploaddoc.uploadedfiles[1].focus() return false} Proszę o pomoc pozdrawiam ![]() -------------------- PHP @ all.
<? while ($cash==0) { $work=0; } ?> |
|
|
![]()
Post
#2
|
|
![]() Grupa: Przyjaciele php.pl Postów: 2 258 Pomógł: 16 Dołączył: 21.09.2004 Skąd: Kielce Ostrzeżenie: (0%) ![]() ![]() |
Pole input file chyba nie ma własności checked, hmm ?
Można to prosto zrobić. Sprawdzaj czy atrybut value jest pusty jak jest pusty to znaczy ze nie ma pliku. Kod if (document.uploaddoc.uploadedfiles[1].value =="")
-------------------- -------------
------ |
|
|
![]()
Post
#3
|
|
![]() Grupa: Zarejestrowani Postów: 41 Pomógł: 0 Dołączył: 30.05.2003 Ostrzeżenie: (0%) ![]() ![]() |
To właśnie też nie dzaiła
Nie sprawdzałem w IE ale w poerze napewno NIE -------------------- PHP @ all.
<? while ($cash==0) { $work=0; } ?> |
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 45 Pomógł: 0 Dołączył: 5.12.2004 Ostrzeżenie: (0%) ![]() ![]() |
jezeli pole nazywa sie:
Kod name="uploadedfiles[1]" to musisz sie do niego inaczej odwolac: Kod document.uploaddoc['uploadedfiles[1]'].value
|
|
|
![]() ![]()
Post
#5
|
|
![]() Grupa: Zarejestrowani Postów: 41 Pomógł: 0 Dołączył: 30.05.2003 Ostrzeżenie: (0%) ![]() ![]() |
dzięki to zadzaiłało
a da się jednocześnie sprawdzić pięć takich samych inputów tz Kod <input type="file" name="uploadedfiles[]"> czy przynajmniej jeden z nich jest niepusty.jeszcze raz dzięki ![]() -------------------- PHP @ all.
<? while ($cash==0) { $work=0; } ?> |
|
|
![]()
Post
#6
|
|
![]() Grupa: Zarejestrowani Postów: 45 Pomógł: 0 Dołączył: 5.12.2004 Ostrzeżenie: (0%) ![]() ![]() |
Kod <script>
function checkForm(t) { var uF = t['uploadedfiles[]'] for (var i = 0; i < uF.length; i++) { if (uF[i].value != '') return true } alert('Proszę wybrać chociaż jeden plik do przesłania') uF[0].focus() return false } </script> <form action="" onsubmit="return checkForm(this)"> <input type="file" name="uploadedfiles[]"> <input type="file" name="uploadedfiles[]"> <input type="file" name="uploadedfiles[]"> <input type="file" name="uploadedfiles[]"> <input type="file" name="uploadedfiles[]"> <input type="submit"> </form> |
|
|
![]() ![]()
Post
#7
|
|
![]() Grupa: Zarejestrowani Postów: 41 Pomógł: 0 Dołączył: 30.05.2003 Ostrzeżenie: (0%) ![]() ![]() |
trochę zakręco ne ale rozumiem
dzięki serdeczne czyli da się to zrobić z nieograniczoną liczbę kontrolek formularza ![]() ------------- i jeszcze jedno pytanie mam funkcję Kod function Blokujuploaddoc(i) { var status; var i; //document.uploaddoc['uploadedfiles['+ i +']'].disabled = true; status = (document.uploaddoc['cupload['+ i +']'].checked == false)? true : false; if(document.uploaddoc['cupload['+ i +']'].checked == false) { document.uploaddoc['uploadedfiles['+ i +']'].disabled = status; } else { document.uploaddoc['uploadedfiles['+ i +']'].disabled = status; } } czego tu brakuje żeby po załadowaniu strony pola document.uploaddoc['uploadedfiles['+ i +']'] pyły niedostępne Ten post edytował berdyk 7.04.2005, 10:33:03 -------------------- PHP @ all.
<? while ($cash==0) { $work=0; } ?> |
|
|
![]()
Post
#8
|
|
![]() Grupa: Zarejestrowani Postów: 45 Pomógł: 0 Dołączył: 5.12.2004 Ostrzeżenie: (0%) ![]() ![]() |
niedostepne tzn nieaktywne czy niewidoczne ?
jak nieaktywne to daj w tagu input: Kod <input type="file" disabled="disabled" /> a jak niewidoczne to mozna przeciez tworzyc dynamicznie lub usuwac nowe pola input, ja bym obstawial za takim rozwiazaniem, ale jak wolisz... |
|
|
![]()
Post
#9
|
|
![]() Grupa: Zarejestrowani Postów: 41 Pomógł: 0 Dołączył: 30.05.2003 Ostrzeżenie: (0%) ![]() ![]() |
to czemu nie napisałeś tego drugiego rozwiązania odrazu
nie zadawałbym teego pytania teraz pozdrawiam Kod function onSChange() { var kolejny = document.getElementById('uploadedfiles[]'); var option = document.createElement('input'); kolejny.add(option); } obiekt nie obsługuje tej właściwości lub metody ![]() Ten post edytował berdyk 7.04.2005, 23:13:35 -------------------- PHP @ all.
<? while ($cash==0) { $work=0; } ?> |
|
|
![]()
Post
#10
|
|
![]() Grupa: Zarejestrowani Postów: 45 Pomógł: 0 Dołączył: 5.12.2004 Ostrzeżenie: (0%) ![]() ![]() |
Kod <script>
function dodaj() { var ip, fc ip = document.createElement('input') fc = document.getElementById('files_container') ip.setAttribute('name', 'uploadedfiles[]') fc.appendChild(ip) } function usun() { var fc, ips fc = document.getElementById('files_container') ips = fc.getElementsByTagName('input') if (ips.length) fc.removeChild(ips[ips.length - 1]) } </script> <form> <a href="javascript:dodaj()">Dodaj</a> <a href="javascript:usun()">Usun</a> <div id="files_container"></div> <input type="submit"> </form> Ten post edytował piechnat 8.04.2005, 01:24:47 |
|
|
![]()
Post
#11
|
|
![]() Grupa: Zarejestrowani Postów: 41 Pomógł: 0 Dołączył: 30.05.2003 Ostrzeżenie: (0%) ![]() ![]() |
funkcję
Kod function dodaj() { własnie tak sobie przerobiłemvar ip, fc ip = document.createElement('input') fc = document.getElementById('files_container') ip.setAttribute('type', 'file') ip.setAttribute('class', 'log')//style=\"width: 430px\ ip.setAttribute('style', 'width: 430px') ip.setAttribute('name', 'uploadedfiles[]') fc.appendChild(ip) } problem teraz polega na tym że daje wszystko w jedenj lini Jak zrobić by dawal linia pod linią a najlepiej jak to umieścić w tabelikażdy input w pozdrawiam Ten post edytował berdyk 8.04.2005, 14:18:29 -------------------- PHP @ all.
<? while ($cash==0) { $work=0; } ?> |
|
|
![]()
Post
#12
|
|
![]() Grupa: Zarejestrowani Postów: 45 Pomógł: 0 Dołączył: 5.12.2004 Ostrzeżenie: (0%) ![]() ![]() |
ojj... troche samodzielnosci, to juz jest analogiczna sprawa:
Kod <script>
function dodaj() { var tr, td, ip, fc tr = document.createElement('tr') td = document.createElement('td') ip = document.createElement('input') fc = document.getElementById('files_container') ip.setAttribute('type', 'file') ip.setAttribute('class', 'log') ip.setAttribute('style', 'width: 430px') ip.setAttribute('name', 'uploadedfiles[]') fc.appendChild(tr) tr.appendChild(td) td.appendChild(ip) } function usun() { var fc, trs fc = document.getElementById('files_container') trs = fc.getElementsByTagName('tr') if (trs.length) fc.removeChild(trs[trs.length - 1]) } </script> <form> <a href="javascript:dodaj()">Dodaj</a> <a href="javascript:usun()">Usun</a> <table><tbody id="files_container"></tbody></table> <input type="submit"> </form> |
|
|
![]()
Post
#13
|
|
![]() Grupa: Zarejestrowani Postów: 41 Pomógł: 0 Dołączył: 30.05.2003 Ostrzeżenie: (0%) ![]() ![]() |
dziękuję ci bardzo serdecznie
ja jestem do tego stopnia zielony z java ze musze prawie o wszystko pytać pozdrawiam -------------------- PHP @ all.
<? while ($cash==0) { $work=0; } ?> |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 18.07.2025 - 01:34 |