Why is my condition onsubmit not returning false?
Posted
by
Liso22
on Stack Overflow
See other posts from Stack Overflow
or by Liso22
Published on 2010-12-27T20:47:03Z
Indexed on
2010/12/27
20:54 UTC
Read the original article
Hit count: 231
After asking a couple of questions I managed to create this form. I didn't have troubles making it return false if the submitted value was 0 but I cannot make it return false when it's the string 'Cambia de ciudad". I'm sure I'm messing with the quotes or something like that. This is the form:
<form role="search" method="get" action="http://chusmix.com/" onsubmit="if (document.getElementById('s')== 'Cambiá de ciudad") return false;'>
<input class="ubicacion" name="s" id="s" tabindex="1" onsubmit="if ((document.getElementById('s').value.length < 4) || (document.getElementById('s')== 'Cambiá de ciudad')) return false;" onfocus="if (this.value=='Cambiá de ciudad') this.value = ''" onblur="if(this.value == '') this.value = 'Cambiá de ciudad'" type="text" maxlength="80" size="28" value="Cambiá de ciudad">
<input type="submit" id="searchsubmit" value="Buscar" />
</form>
How do I make it work? Thanks
© Stack Overflow or respective owner