PDA

View Full Version : Why the submit response of my form is empty



Magicbob
13 Sep 2007, 1:34 PM
Hello

I have a problem with the submission of a form.

The look is good but and everything seems to be ok but when i submit it, i have no values posted

I use a template to generate my form :



this.Formulaire_Template.overwrite(this.dlgEdition.body.id,this.Formulaire_Template_Labels);


I then create the form :



this.fs = new Ext.form.Form({
waitMsgTarget:Ext.get(this.Formulaire_Conteneur),
url:this.Formulaire_url_Validation,
scope: this,
labelSeparator: ' ',
reader: new Ext.data.JsonReader({root: 'record',successProperty: 'success'}, Ext.data.Record.create(this.Formulaire_Record_Datas))
});


I add the fields to the form and apply them to the template :



this.fs.add(new Ext.form.DateField({width:217,labelSeparator: ' ',name: 'internautes-internaute_date_naissance',menu: new YearIncrementableDateMenu(),allowBlank:false,blankText: _('internautes-erreur-date_naissance'),format:'d M Y'}).applyTo('internautes-internaute_date_naissance'));
this.fs.add(new Ext.form.ComboBox({width: 217,labelSeparator: ' ',name: 'internautes-id_ville',store: this.ds_villes,minChars: 1,editable: true,mode: 'remote', valueField: 'id_ville',displayField:'ville_majuscule',typeAhead: false,loadingText: _('internautes-recherche_ville'),hideTrigger:false,triggerAction: 'all',forceSelection: true,emptyText: _('internautes-selection_ville'),allowBlank:false,blankText: _('internautes-erreur-ville-vide'),selectOnFocus:false}).applyTo('internautes-id_ville'));
this.fs.add(new Ext.form.ComboBox({width: 217,labelSeparator: ' ',name: 'internautes-id_type_internaute',store: this.ds_types_internautes,editable: false,mode: 'remote', valueField: 'id_type_internaute',displayField:'type_internaute',typeAhead: false,loadingText: _('internautes-recherche_type_internaute'),hideTrigger:false,triggerAction: 'all',forceSelection: true,emptyText: _('internautes-selection_type_internaute'),allowBlank:false,blankText: _('internautes-erreur-type_internaute-vide'),selectOnFocus:false}).applyTo('internautes-id_type_internaute'));
this.fs.add(new Ext.form.TextFieldRemoteVal({width: 200,labelSeparator: ' ',name: 'internautes-internaute_pseudo',remoteValidation: 'onBlur',urlRemoteVal: 'php/internautes/controle_champs.php',paramsRemoteVal: {champs: 'internaute_pseudo'}}).applyTo('internautes-internaute_pseudo'));
this.fs.add(new Ext.form.TextFieldRemoteVal({width: 200,labelSeparator: ' ',name: 'internautes-internaute_nom',remoteValidation: 'onBlur',urlRemoteVal: 'php/internautes/controle_champs.php',paramsRemoteVal: {champs: 'internaute_nom'}}).applyTo('internautes-internaute_nom'));
this.fs.add(new Ext.form.TextFieldRemoteVal({width: 200,labelSeparator: ' ',name: 'internautes-internaute_prenom',remoteValidation: 'onBlur',urlRemoteVal: 'php/internautes/controle_champs.php',paramsRemoteVal: {champs: 'internaute_prenom'}}).applyTo('internautes-internaute_prenom'));
this.fs.add(new Ext.form.TextFieldRemoteVal({width: 200,labelSeparator: ' ',name: 'internautes-internaute_email',remoteValidation: 'onBlur',urlRemoteVal: 'php/internautes/controle_champs.php',paramsRemoteVal: {champs: 'internaute_email'}}).applyTo('internautes-internaute_email'));
this.fs.add(new Ext.form.TextFieldRemoteVal({width: 200,labelSeparator: ' ',name: 'internautes-internaute_password',name2: '',remoteValidation: 'onBlur',urlRemoteVal: 'php/internautes/controle_champs.php',paramsRemoteVal: {champs: 'internaute_password'}}).applyTo('internautes-internaute_password'));
this.fs.add(new Ext.form.TextFieldRemoteVal({width: 200,labelSeparator: ' ',name: 'internautes-internaute_telephone',remoteValidation: 'onBlur',urlRemoteVal: 'php/internautes/controle_champs.php',paramsRemoteVal: {champs: 'internaute_telephone'}}).applyTo('internautes-internaute_telephone'));
this.fs.add(new Ext.form.TextFieldRemoteVal({width: 200,labelSeparator: ' ',name: 'internautes-internaute_icq',remoteValidation: 'onBlur',urlRemoteVal: 'php/internautes/controle_champs.php',paramsRemoteVal: {champs: 'internaute_icq'}}).applyTo('internautes-internaute_icq'));
this.fs.add(new Ext.form.TextFieldRemoteVal({width: 200,labelSeparator: ' ',name: 'internautes-internaute_msn',remoteValidation: 'onBlur',urlRemoteVal: 'php/internautes/controle_champs.php',paramsRemoteVal: {champs: 'internaute_msn'}}).applyTo('internautes-internaute_msn'));
this.fs.add(new Ext.form.TextArea({width:200,labelSeparator: ' ',name: 'internautes-internaute_commentaire',grow: true,preventScrollbars:true}).applyTo('internautes-internaute_commentaire'));
this.fs.add(new Ext.form.TextArea({width:200,labelSeparator: ' ',name: 'internautes-internaute_adresse',grow: true,preventScrollbars:true}).applyTo('internautes-internaute_adresse'));


I render the form :



this.fs.load({
url:this.Datastore_url,
method: 'POST',
params: {isform: true,id: this.grid.getSelectionModel().getSelected().id,prefix: this.Prefix},
waitMsg:'Chargement des donnees...',
success: this.EditionChargementOk,
failure: this.EditionChargementProblem,
scope: this
});

this.fs.end();
this.fs.render(this.Formulaire_Name);


and here is the submit part :



options = {
method: 'POST',
scope:this,
waitMsg:'Inscription en cours...',
success: function(formulaire, action) {
this.dlgEdition.hide();
Ext.Msg.alert('Inscription', _("inscription-reussie"));
},
failure: function(formulaire, action) {
Ext.Msg.alert('Inscription', _("inscription-erreur-probleme"));
}
};
this.fs.submit(options);


When i submit the form , the values of field are not posted. Could someone help me?

Thanks

Magicbob

Magicbob
15 Sep 2007, 1:22 PM
No response? Here are a bit more informations :

The template i use :

[CODE]
<center>
<div class="fondBlanc" id="internautes-conteneur">
<div id="internautes-form-edition" name="internautes-form-edition" class="x-form">
<div id="internautes-message-err"></div>
<br/>

<div class="x-form-ct x-form-label-right">

<div class="x-form-ct x-form-column x-form-label-right" style="margin-left:15px;width: 370px;">

<fieldset class="x-form-label-right">
<legend>Mon compte</legend>
<div class="x-form-item">
<label for="internautes-internaute_pseudo">{internautes-label-internaute_pseudo}</label>
<div class="x-form-element"><input type="text" class="x-form-text x-form-field" id="internautes-internaute_pseudo" name="internautes-internaute_pseudo" /></div>
</div>
<div class="x-form-item">
<label for="internautes-internaute_email">{internautes-label-internaute_email}</label>
<div class="x-form-element"><input type="text" class="x-form-text x-form-field" id="internautes-internaute_email" name="internautes-internaute_email" /></div>
</div>
<div class="x-form-item">
<label for="internautes-internaute_password">{internautes-label-internaute_password}</label>
<div class="x-form-element"><input type="password" class="x-form-text x-form-field" id="internautes-internaute_password" name="internautes-internaute_password" /></div>
</div>
<div class="x-form-item">
<label for="internautes-id_type_internaute">{internautes-label-id_type_internaute}</label>
<div class="x-form-element"><input type="text" class="x-form-text x-form-field" id="internautes-id_type_internaute" name="internautes-id_type_internaute" /></div>
</div>
</fieldset>

<fieldset class="x-form-label-right">
<legend>Identit

Magicbob
16 Sep 2007, 11:34 PM
No one can help?

Thanks

Magicbob

Animal
16 Sep 2007, 11:43 PM
You are saying that the server is not recieving the values?

How are you testing this?

Does Firebug report that an XHR POST is taking place? What does the POST body look like?

Do you have Fiddler? Examine the HTTP packet with Fiddler to see what it contains.

Magicbob
16 Sep 2007, 11:47 PM
Hello

Thank you for your response.

I am using Firebug and the xhr post happens. But in the Post tab, there are no values.

I don t have fiddler. What is it? Where can i find this?

Thanks

Magicbob

Animal
17 Sep 2007, 12:09 AM
OK, if Firebug has no values, then I think you have a bug somewhere. Fidler would only tell you the same thing.

http://fiddlertool.com if you are interested. It's a useful tool.

Is it sending the field names with no values attached, eg



paramname=&therParamname=&newtParamName=


Because this:



this.fs.load({
url:this.Datastore_url,
method: 'POST',
params: {isform: true,id: this.grid.getSelectionModel().getSelected().id,prefix: this.Prefix},
waitMsg:'Chargement des donnees...',
success: this.EditionChargementOk,
failure: this.EditionChargementProblem,
scope: this
});

this.fs.end();
this.fs.render(this.Formulaire_Name);


Loads the form before it renders it, so there will be no fields to distribute the loaded data to.

Can you post up a link to a running page?

Magicbob
17 Sep 2007, 12:20 AM
The load is working. It is filling textfield,datefield and combobox. The problem of blank fields is only when i submit

For the link it wont be easy because it is inside a quite complex application, but i can try to do a page with only this part

Thank you

Magicbob

Magicbob
30 Sep 2007, 4:52 PM
Just in case it could help someone, here is the solution i found :

i replace :


<div id="internautes-form-edition" name="internautes-form-edition" class="x-form">

by


<form id="internautes-form-edition" name="internautes-form-edition" class="x-form">

in my template

then i replace :


this.fs = new Ext.form.Form({
waitMsgTarget:Ext.get(this.Formulaire_Conteneur),
url:this.Formulaire_url_Validation,
scope: this,
labelSeparator: ' ',
reader: new Ext.data.JsonReader({root: 'record',successProperty: 'success'}, Ext.data.Record.create(this.Formulaire_Record_Datas))
});

by


this.fs=new Ext.form.BasicForm(Ext.getDom(this.Formulaire_Name),{
id:this.Formulaire_Name,
url:this.Formulaire_url_Validation,
scope: this,
reader: new Ext.data.JsonReader({root: 'record',successProperty: 'success'}, Ext.data.Record.create(this.Formulaire_Record_Datas))
});

and i remove this :


this.fs.end();
this.fs.render(this.Formulaire_Name);

because the form is already rendered

With this, i have just one form and all my fields are submitted normally

Magicbob