PDA

View Full Version : [ask] Problem Submit basic form



g47o7
10 Jun 2008, 1:56 AM
I have a problem for submit form using basix ext

source code index.html :

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Default SCTV</title>
<link href="../css/sctv.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../css/ext-all.css" />
<!-- GC --> <!-- LIBS -->
<script type="text/javascript" src="../js/adapter/ext/ext-base.js"></script>
<!-- ENDLIBS -->
<script type="text/javascript" src="../js/ext-all.js"></script>
</head>
<body style="margin:5px 10px 10px 10px">
<script language='JavaScript' type='text/javascript' src='../js/myajax.js'></script>
<form id='form1'><table width='100%'>
<tr>
<td class='text' width='15%'>
Name :
</td>
<td class='x-form-element'>
<input type='name' name='text' value='' size='30' maxlength='30' id='name'>
</td>
<tr>
<td class='text' width='15%'>
Place of Birth :</td>
<td class='x-form-element'>
<input type='place' name='text' value='' size='30' maxlength='30' id='place'>
</td>
</tr>
<tr>
<td class='text' width='15%'>
Date of Birth :</td>
<td class='x-form-element'>
<input type='date' name='text' value='' size='15' maxlength='15' id='date'>
</td>
</tr>
<tr>
<td class='textaddress' width='15%'>
Address :</td>
<td>
<textarea name='address' cols='35' rows='3' id='address'></textarea>
</td>
</tr>
<tr>
<td class='text' width='15%'>
City :</td>
<td class='x-form-element'>
<select name='city' id='city'>
<option value='0' selected>Select
</select>
</td>
</tr>
<tr>
<td class='text' width='15%'>
</td>
<td>
<input type='hidden' name='aksi' value='' >
</form>
<input type='button' name='submit' value='Save' id='submit'>
</td>
</tr>
</table>

</body>
</html>

And code myajax.js:

Ext.onReady(function(){
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'under';
var name = new Ext.form.TextField({
allowBlank:false
});
name.applyTo('name');
var place = new Ext.form.TextField({
allowBlank:false
});
place.applyTo('place');
var date = new Ext.form.DateField({
format:"d/m/Y",
allowBlank:false
});
date.applyTo('date');
var city = new Ext.form.ComboBox({
typeAhead: true,
triggerAction: 'all',
transform:'city',
width:120,
forceSelection:true
});
var address = new Ext.form.TextArea({
grow:false
});
address.applyTo('address');

Ext.get('form1').on({
submit:function(e){
e.preventDefault();
return false;
}
});

Ext.get('submit').on('click', function(){
var par = Form.serialize('form1');
par.load({
url: 'default.php?mode=input',
});
});
});

});

Please help me for submiting use basic extj...?