Jump to content
Fórum Script Brasil
  • 0

Javascript + PHP


Raphael Miranda

Question

@EDIT

Desculpe, estava com pressa e não li o aviso lá em cima, deveria ter postado na seção de javascript

@tópico

Olá, eu estou tentando criar um website em javascript para celular com um formulário.

Quando a pessoa terminar de preencher o formulário eu queria que ele chamasse outra pagina em php que se encarregaria de pegar os dados do formulário e usasse eles para inserção no bando de dados.

Minha dúvida é só no código javascript (js), pois não sei como chamar o arquivo php e passar os dados do formulário. Segue o código do js:

Ext.setup({
    icon: 'icon.png',
    tabletStartupScreen: 'tablet_startup.png',
    phoneStartupScreen: 'phone_startup.png',
    glossOnIcon: false,
    onReady: function() {

        var form;

        Ext.regModel('User', {
            fields: [
                {name: 'name',     type: 'string'},
                {name: 'idade', type: 'int'},
            ]
        });

        var formBase = {
            scroll: 'vertical',
            url   : 'postUser.php',
            standardSubmit : false,
            items: [{
                    xtype: 'fieldset',
                    title: 'Informacoes pessoais',
                    instructions: 'Coloque suas informacoes acima.',
                    defaults: {
                        required: true,
                        labelAlign: 'left',
                        labelWidth: '40%'
                    },
                    items: [
                    {
                        xtype: 'textfield',
                        name : 'name',
                        label: 'Nome',
                        useClearIcon: true,
                        autoCapitalize : false
                    }, {
                        xtype: 'textfield',
                        name : 'idade',
                        label: 'Idade',
                        useClearIcon: true
                    }]
                }
            ],
            listeners : {
                submit : function(form, result){
                    console.log('success', Ext.toArray(arguments));
                },
                exception : function(form, result){
                    console.log('failure', Ext.toArray(arguments));
                }
            },

            dockedItems: [
                {
                    xtype: 'toolbar',
                    dock: 'bottom',
                    items: [
                        {xtype: 'spacer'},
                        {
                            text: 'Resetar',
                            handler: function() {
                                form.reset();
                            }
                        },
                        {
                            text: 'Salvar',
                            ui: 'confirm',
                            handler: function() {
                                form.submit({
                                    waitMsg : {message:'Confirmando', cls : 'demos-loading'}
                                });
                            }
                        }
                    ]
                }
            ]
        };

        if (Ext.is.Phone) {
            formBase.fullscreen = true;
        } else {
            Ext.apply(formBase, {
                autoRender: true,
                floating: true,
                modal: true,
                centered: true,
                hideOnMaskTap: false,
                height: 385,
                width: 480
            });
        }

        form = new Ext.form.FormPanel(formBase);
        form.show();
    }
});

Como devo fazer? já tenho o arquivo postUser.php que faz a parte do banco de dados, mas parece que o js nem chama o arquivo, só aparece a janela de "Carregando" e nada acontece.

Edited by Raphael Miranda
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...