Bonjour tout le monde!
Je viens de tomber sur une erreur assez surprenante (qui comme par hasard ne se produit que chez ie).
Je m'explique...
J'ai dans une page tpl, un formulaire qui permet de faire un upload de flv...
Voici le code :
Donc dans ce form, j'ai tous les champs d'info du flv, et plusieurs div cach�es pour les erreurs et une qui contient le loader (le gif anim�s)...
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 <form enctype="multipart/form-data" method="post" action="index.php"> <input type="hidden" name="MAX_FILE_SIZE" value="10485760" /> <input type="hidden" name="activemenu" value="smenu0" /> <input type="hidden" name="page" value="library" /> <input type="hidden" name="section" value="library" /> <input type="hidden" name="tab" value="library_upload" /> <input type="hidden" name="action" value="uploadtolibrary" /> <table class="libraryForm"> <tr> <td align="right"><strong>Title*: </strong></td> <td><input type="text" id="title" name="title" size="25" value="" /></td> </tr> <tr> <td align="right"><strong>Tags (use , as separator)*: </strong></td> <td><input type="text" id="tag" name="tag" size="35" value="" /></td> </tr> <tr> <td align="right"><strong>Description: </strong></td> <td><textarea id="description" name="description" rows="3" cols="35"></textarea></td> </tr> <tr> <td align="right"><strong>File: </strong></td> <td><input type="file" id="file_to_upload_into_library" name="flv_file"/> {$locale.format_choice}</td> </tr> <tr> <td colspan="2" align="center"><br /><input type="button" name="button" value="{$locale.button_upload}" onClick="ValiderFormUploadLibrary('file_to_upload_into_library','tag','title','error_upl_into_library','errorformat_upl_into_library','error_missing_info','ajaxloader',this.form);"/></td> </tr> </table> </form> <div id="error_upl_into_library" style="display: none"> <div class="dragRouge"> <em><strong>{$locale.upload_errornofile}</strong></em> </div> </div> <div id="errorformat_upl_into_library" style="display: none"> <div class="dragRouge"> <em><strong>{$locale.upload_errorbadformat}</strong></em> </div> </div> <div id="error_missing_info" style="display: none"> <div class="dragRouge"> <em><strong>{$locale.upload_missinginfo}</strong></em> </div> </div> <div id="ajaxloader" style="display: none" align="center"> <img src="{$conf.path_to_pictures}/ajax-loader.gif" alt="ajax-loader" title="ajax-loader" /> </div>
Lorsque l'utilisateur clique sur upload, une fonction javascript est �x�cut�e, elle controle les donn�es, affiche les div d'erreur si n�c�ssaire et affiche la div contenant le gif anim�, juste avant de faire le submit du formulaire...
Voila le code de cette fonction js:
Donc ce code marche super bien pour tous les navigateurs (ah ouais et aussi marche pour un upload de mp3
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 function ValiderFormUploadLibrary(data_id, tag_id, title_id, errornofile_id, errorformat_id, errorinfo_id, loader_id, formulaire) { var file_to_download = document.getElementById(data_id).value; var tags = (document.getElementById(tag_id).value).replace(/(^\s*)|(\s*$)/g,""); var title_name = (document.getElementById(title_id).value).replace(/(^\s*)|(\s*$)/g,""); var errnofilediv =document.getElementById(errornofile_id).style; var errformatdiv =document.getElementById(errorformat_id).style; var errinfodiv =document.getElementById(errorinfo_id).style; var loaderdiv =document.getElementById(loader_id).style; if ((tags == "") || (title_name == "")) { errnofilediv.display="none"; errformatdiv.display="none"; errinfodiv.display="block"; loaderdiv.display="none"; } else if (file_to_download == "") { errnofilediv.display="block"; errformatdiv.display="none"; errinfodiv.display="none"; loaderdiv.display="none"; } else { nbchar = file_to_download.length; extension = file_to_download.substring(nbchar-4,nbchar); extension=extension.toLowerCase(); if ((extension != ".flv")) { errformatdiv.display="block"; errnofilediv.display="none"; errinfodiv.display="none"; loaderdiv.display="none"; } else { loaderdiv.display="block"; errformatdiv.display="none"; errnofilediv.display="none"; errinfodiv.display="none"; formulaire.submit(); } } }) mais pour l'upload de FLV...c'est une autre histoire! Le gif s'affiche bien mais se bloque!!
J'ai fais quelques tests en mettant un alert avant le submit dans le js, et dans ce cas la, le gif est bien anim�, mais d�s que je clique sur le bouton ok du message alert, hop il se bloque (d'ou ma d�duction que le probl�me vient de ce submit) mais l'upload marche nickel...le flv est bien upload�...
Enfin voila...si quelqu'un a une petite id�e, �a me rendrait bien service...
Merci a tous.
A+
Partager