The Joomla! Forum ™






Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Thu Apr 26, 2012 5:59 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Feb 08, 2012 5:10 pm
Posts: 13
Oi galera...confundiu um pouco aki:
No meu artigo, tenho meu form de consulta ( testando sem o action ) dentro de minha div.
Estou usando o submit assim:
Code:
<input onclick="carregaResult('http://localhost/ProjetoEscola/resCalcMatr.php');return false" type="submit" value="CALCULAR" />

onde carregaResult ( ) é :
Code:
function carregaResult( pag ){ // Carrega página de resposta dentro da div todoform
                var url = "";
                url = pag;
                $('#todoform').load(""+url+"");       
            }

Quando utilizo o onclick no botão submit, ele chama a página certinho dentro da div, mas não passa os parâmetros digitados no meu form.
A pergunta é : Tenho obrigatoriamente q usar o action e o onclick ?


Top
 Profile  
 
PostPosted: Thu Apr 26, 2012 6:12 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Apr 24, 2012 8:49 am
Posts: 41
Pode apanhar os valores com os id´s dos inputs:
$(idinput).value

a url está á espera dos valores por POST ou GET ?

_________________
Joomla Enterprise Projects Manager and Developer
JoomlaPT! administrator


Top
 Profile  
 
PostPosted: Thu Apr 26, 2012 6:14 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Feb 08, 2012 5:10 pm
Posts: 13
post


Top
 Profile  
 
PostPosted: Thu Apr 26, 2012 6:26 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Apr 24, 2012 8:49 am
Posts: 41
function carregaResult( pag ){
var valueinput = $(idinput).value;
var req = new Request({
method: 'post',
url: pag,
data: { 'vardopost' : valueinput },
onComplete: function(response) {
$('#todoform').set('html',response);
}
}).send();
}

_________________
Joomla Enterprise Projects Manager and Developer
JoomlaPT! administrator


Top
 Profile  
 
PostPosted: Fri Apr 27, 2012 12:00 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Feb 08, 2012 5:10 pm
Posts: 13
Grato, colega...só não entendo porque não está executando em php.


Top
 Profile  
 
PostPosted: Fri Apr 27, 2012 5:31 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Apr 24, 2012 8:49 am
Posts: 41
Ninja2112 wrote:
Grato, colega...só não entendo porque não está executando em php.


A função que escrevi é js e não php

_________________
Joomla Enterprise Projects Manager and Developer
JoomlaPT! administrator


Top
 Profile  
 
PostPosted: Sat Apr 28, 2012 6:13 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Feb 08, 2012 5:10 pm
Posts: 13
Ok...me referi a passagem de parametros para a página .php.
Usando o código que voce me indicou, então ficaria assim (?):
Code:
 function carregaResult( pag ){
            var valueinput = $(slcConv).value;
            var valueinput1 = $(txtVlPrest).value;
            var valueinput2 = $(qtdeParc).value;
            var req = new Request({
            method: 'post',
            url: pag,
            data: { 'vardopost' : valueinput,valueinput1,valueinput2 },
            onComplete: function(response) {
            $('#todoform').set('html',response);
            }
   }).send();
   }



Top
 Profile  
 
PostPosted: Sat Apr 28, 2012 6:57 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Apr 24, 2012 8:49 am
Posts: 41
function carregaResult( pag ){
var valueinput = $('#slcConv').value;
var valueinput1 = $('#txtVlPrest').value;
var valueinput2 = $('#qtdeParc').value;
var req = new Request({
method: 'post',
url: pag,
data: {
'vardopost' : valueinput,
'vardopost2' : valueinput1,
'vardopost2' : valueinput2
},
onComplete: function(response) {
$('#todoform').set('html',response);
}
}).send();
}

Pode apanhar depois no php as vars
$_POST["vardopost"]
$_POST["vardopost1"]
$_POST["vardopost2"]

_________________
Joomla Enterprise Projects Manager and Developer
JoomlaPT! administrator


Top
 Profile  
 
PostPosted: Sun Apr 29, 2012 1:03 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Feb 08, 2012 5:10 pm
Posts: 13
Nada ainda...está dando o seguinte erro:
SCRIPT438: O objeto não oferece suporte à propriedade ou método 'set'


Top
 Profile  
 
PostPosted: Sun Apr 29, 2012 3:10 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Apr 24, 2012 8:49 am
Posts: 41
Qual a versão do Joomla ou do mootools ?

_________________
Joomla Enterprise Projects Manager and Developer
JoomlaPT! administrator


Top
 Profile  
 
PostPosted: Sun Apr 29, 2012 11:44 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Feb 08, 2012 5:10 pm
Posts: 13
Estou usando o Joomla 1.7.0


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 7:44 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Apr 24, 2012 8:49 am
Posts: 41
Substitui
$('#todoform').set('html',response);
por
document.getElementById('todoform').innerHTML = response;

_________________
Joomla Enterprise Projects Manager and Developer
JoomlaPT! administrator


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 1:44 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Wed Feb 08, 2012 5:10 pm
Posts: 13
Agora funfou...e também substituí o
var valueinput = $('#slcConv').value;
por var campoConv = document.getElementById('slcConv').value;
porque ele não estava passando os parâmetros...

Grato


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 



Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group