.Codebits 2008

.Ofertas SAPO Emprego

.posts recentes

. tartaruga

. pppp

. dfgfg

. Farmácias, SAPO e Meo

. Happy 1234567890

. Boas Festas

. Procura-se

. SAPO Codebits 2008. O eve...

. javascript submit gotcha

. Adeptos de futebol

.arquivos

. Março 2011

. Outubro 2009

. Março 2009

. Fevereiro 2009

. Dezembro 2008

. Outubro 2008

. Setembro 2008

. Julho 2008

. Fevereiro 2008

. Janeiro 2008

. Dezembro 2007

. Novembro 2007

. Outubro 2007

. Setembro 2007

.fotos

Sexta-feira, 18 de Julho de 2008

javascript submit gotcha

Yesterday a colleague called me for help in debugging a piece of javascript. He was at that point where it looked more like voodoo than an actual bug in his software.

The code was trying to submit a form after some filed validations, and so he, correctly had:

f.submit();

But that was not working, and it was  hard to figure out why.

After a few minutes we realized that the HTML on the submit button read something like

<input type="submit" name="submit" .......... onclick="....">

So what happened was that the 'name' attribute was conflicting with the form's submit method. Whan calling f.submit(); instead of calling the method, the interpreter acted as trying to access the property.

This happened in Opera and Firefox. We haven't tryied with other browsers.

 

publicado por js às 11:46
link do post | comentar | favorito
|

.Unix Time

.pesquisar

 

.Março 2011

Dom
Seg
Ter
Qua
Qui
Sex
Sab
1
2
3
4
5
6
7
8
9
10
11
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

.tags

. todas as tags

blogs SAPO

.subscrever feeds