Strange behavior with serialize and object literals
hi!
i'm having a strange issue.
my code:
GEvent.addListener(map, 'infowindowbeforeclose', function() {
var form1 = $('#window_form_tab1').serialize();
var name = form1.name_field;
alert(form1);
//save(marker, $('#window_form_tab1').serialize());
});
and this is the form:
''+
'<div id=\'window_div1\' style=\'width: 300px; height: 300px; \'>'+
' <form id=\'window_form_tab1\'>'+
' <label>Tipo de espaço</label>'+
' <select id=\'spatial_object_type\' name=\'spatial_object_type\'>'+
' </select><br/>'+
' <label>Nome do espaço</label><br/>'+
' <input id=\'name_field\' name=\'name_field\' type=\"text\" value='+marker.name+'><br/>'+
' <label>Descrição</label><br/>'+
' <textarea id=\'description\' name=\'description\' rows=\"10\" cols=\"23.5\">'+marker.description+'</textarea><br/>'+
' </form>'+
'</div>';
The strange thing about this is that when i print (with alert function) the form1 variable, everything goes fine but when i try to access, for example, form1.name_field, it prints undefined. What the hell...?