Envio de Formulario

3 messages Options
Embed this post
Permalink
kiaskaetano

Envio de Formulario

Reply Threaded More More options
Print post
Permalink
Boa Noite,

Gente estou precisando de uma ajuda, sou novo no Zope e estou com uns problemas pra enviar um formulario, segue o codigo HTMl.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html metal:use-macro="here/main_template/macros/master">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style3 {font-size: large}

.formulario_capli {
   border: 1px solid #000000;
}

.titulo_capli {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:14px;
    text-align:center;
    padding-left:10px;
    font-weight: bold;
}

.formulario_capli td {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:12px;
    text-align:left;
    padding-left:10px;
}
.negrito{
    font-weight:bold;
}
.lembrete{
    color:#FF0000;
    font-size:10px;
}
-->
</style>
<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function insere() {
        document.form1.solicitacao.value += document.form1.lista.value + '\n\n';
}
//-->
</script>
</head>

<body metal:fill-slot="main">
<form id="form1" name="form1" method="post" action="form.py">
<table width="500" border="0" cellspacing="2" cellpadding="0" class="formulario_capli" align="center">
  <tr>

    <td colspan="2"><div align="center"><p><img src="capli-logo.jpg" width="191" height="60" /></p></div></td>

  </tr>
  <tr>
    <td colspan="2"><div align="center"><p class="titulo_capli">Solicitação de Material</p></div></td>
    </tr>
  </table>
  <table width="500" border="0" cellspacing="2" cellpadding="5" class="formulario_capli" align="center">
  <tr>
    <td width="120px" align="right" class="negrito">Nome Completo:</td>
    <td>
      <input id="nome_completo" type="text" name="nome_completo" style="width:300px" size="20"/>    </td>
  </tr>
  <tr>
    <td align="right" class="negrito">Área de Lotação: </td>
    <td><input id="area_lotacao" type="text" name="area_lotacao"  style="width:240px" size="20"/></td>
  </tr>
  <tr>
    <td align="right" class="negrito">Ramal:</td>
    <td>
    <input id="ramal" type="text" name="ramal" style="width:60px" size="20" /></td>
  </tr>
  <tr>
    <td align="right" class="negrito">E-mail (ITI):</td>
    <td>
    <input id="email" type="text" name="email" style="width:240px" size="20" /></td>
  </tr>
  <tr>
    <td align="right" colspan="2">
    <center><b class="lembrete">Selecione o material desejado e clique no botão abaixo para inserí-lo à lista de solicitação. Não esqueça            de indicar a quantidade desejada.</b></center> <br>
    <SELECT Name="lista" style="width: 100%;" size="10">

<OPTION Value="Alfinete mapa, Material metal tratamento superficial niquelado.-- QTD: ">Alfinete mapa, Material metal tratamento superficial niquelado.
<OPTION Value="Almofada para carimbo nº 03 cor preta. Marca: POLY.-- QTD: ">Almofada para carimbo nº 03 cor preta. Marca: POLY.
<OPTION Value="Almofada para carimbo nº 04 cor azul. Marca: JAPAN SPAN.-- QTD: ">Almofada para carimbo nº 04 cor azul. Marca: JAPAN SPAN.
<OPTION Value="Apontador de lápis material tipo escolar Plastico

</SELECT>
   
    </td>
  </tr>
  <tr>
    <td align="right" colspan="2">  
    <p align="center"><INPUT Type="button" Value="Adicionar material à solicitação" onClick="insere();"></td>
  </tr>
  <tr><td align="right" class="negrito">Solicitação:</td></tr>
   <tr>
   <td colspan="2">

    <TEXTAREA id="solicitacao" Name="solicitacao" rows="10" style="width: 100%;" cols="20"></TEXTAREA>
  </tr>
  <tr>
    <td colspan="2">
   
      <div align="center"><input type="submit" name="Submit" value="Enviar" id="Submit" /></div></td>
  </tr>
</table>
</form>
</body>
</html>

O Phyton

from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE =  request.RESPONSE
mailhost = context.MailHost
mail_to = "[hidden email]"
nome_completo = request['nome_completo']
area_lotacao = request['area_lotacao']
tipo = request['tipo']
email_from_address = request['email']
ramal = request['ramal']
solicitacao = request['solicitacao']

msg = """

Formulario de Atendimento.

Nome............: %s
Area de Lotacao.: %s
Tipo............: %s
Ramal...........: %s
E-mail..........: %s
Solicitacao.....:
%s
""" % (nome_completo, area_lotacao, tipo, ramal, email_from_address, solicitacao)

#print msg
#return printed

email_assunto = "Solicitacao de atendimento"

mailhost.send(msg, mail_to, email_from_address, email_assunto)
return RESPONSE.redirect("http://alguma_pagina")

O erro,

Quando enviado a pagina html q aparece naum recebe os valores
 <TEXTAREA id="solicitacao" Name="solicitacao" rows="10"

Se alguem poder me ajudar ficarei muito grato.




Vanderson Mota dos Santos

Re: Envio de Formulario

Reply Threaded More More options
Print post
Permalink
Opa, pelo o que tive olhando do seu código, acredito que tenham opções
em python melhores que Zope para fazer isso:

Django:
http://www.djangobrasil.org/
www.aprendendodjango.com

Se quiser permanecer no ecossistema Zope, use o grok:
http://grok.zope.org/


Fazer uma aplicação em Zope "puro" hoje em dia eu acho totalmente antiprodutivo.

Sobre o seu problema,

a template tem que ter os attributos assim:

<TEXTAREA  tal:content="REQUEST/solicitacao" id="solicitacao"
Name="solicitacao" rows="10" style="width: 100%;"
cols="20"></TEXTAREA>

Que a template pegará o atributo enviado pelo formulário.


Bom, acho que é isso.

abraços!

2009/7/24 kiaskaetano <[hidden email]>:

>
>
> Boa Noite,
>
> Gente estou precisando de uma ajuda, sou novo no Zope e estou com uns
> problemas pra enviar um formulario, segue o codigo HTMl.
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html metal:use-macro="here/main_template/macros/master">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> <title>Untitled Document</title>
> <style type="text/css">
> <!--
> .style3 {font-size: large}
>
> .formulario_capli {
> border: 1px solid #000000;
> }
>
> .titulo_capli {
> font-family:Verdana, Arial, Helvetica, sans-serif;
> font-size:14px;
> text-align:center;
> padding-left:10px;
> font-weight: bold;
> }
>
> .formulario_capli td {
> font-family:Verdana, Arial, Helvetica, sans-serif;
> font-size:12px;
> text-align:left;
> padding-left:10px;
> }
> .negrito{
> font-weight:bold;
> }
> .lembrete{
> color:#FF0000;
> font-size:10px;
> }
> -->
> </style>
> <script type="text/JavaScript">
> <!--
> function MM_jumpMenu(targ,selObj,restore){ //v3.0
> eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
> if (restore) selObj.selectedIndex=0;
> }
>
> function insere() {
> document.form1.solicitacao.value += document.form1.lista.value + '\n\n';
> }
> //-->
> </script>
> </head>
>
> <body metal:fill-slot="main">
> <form id="form1" name="form1" method="post" action="form.py">
> <table width="500" border="0" cellspacing="2" cellpadding="0"
> class="formulario_capli" align="center">
> <tr>
>
> <td colspan="2"><div align="center"><p><img src="capli-logo.jpg" width="191"
> height="60" /></p></div></td>
>
> </tr>
> <tr>
> <td colspan="2"><div align="center"><p
> class="titulo_capli">Solicitação de Material</p></div></td>
> </tr>
> </table>
> <table width="500" border="0" cellspacing="2" cellpadding="5"
> class="formulario_capli" align="center">
> <tr>
> <td width="120px" align="right" class="negrito">Nome Completo:</td>
> <td>
> <input id="nome_completo" type="text" name="nome_completo"
> style="width:300px" size="20"/> </td>
> </tr>
> <tr>
> <td align="right" class="negrito">Área de Lotação:
> </td>
> <td><input id="area_lotacao" type="text" name="area_lotacao"
> style="width:240px" size="20"/></td>
> </tr>
> <tr>
> <td align="right" class="negrito">Ramal:</td>
> <td>
> <input id="ramal" type="text" name="ramal" style="width:60px" size="20"
> /></td>
> </tr>
> <tr>
> <td align="right" class="negrito">E-mail (ITI):</td>
> <td>
> <input id="email" type="text" name="email" style="width:240px" size="20"
> /></td>
> </tr>
> <tr>
> <td align="right" colspan="2">
> <center><b class="lembrete">Selecione o material desejado e clique no botão
> abaixo para inserí-lo à lista de solicitação. Não esqueça de indicar a
> quantidade desejada.</b></center> <br>
> <SELECT Name="lista" style="width: 100%;" size="10">
>
> <OPTION Value="Alfinete mapa, Material metal tratamento superficial
> niquelado.-- QTD: ">Alfinete mapa, Material metal tratamento superficial
> niquelado.
> <OPTION Value="Almofada para carimbo nº 03 cor preta. Marca: POLY.-- QTD:
> ">Almofada para carimbo nº 03 cor preta. Marca: POLY.
> <OPTION Value="Almofada para carimbo nº 04 cor azul. Marca: JAPAN SPAN.--
> QTD: ">Almofada para carimbo nº 04 cor azul. Marca: JAPAN SPAN.
> <OPTION Value="Apontador de lápis material tipo escolar Plastico
>
> </SELECT>
>
> </td>
> </tr>
> <tr>
> <td align="right" colspan="2">
> <p align="center"><INPUT Type="button" Value="Adicionar material à
> solicitação" onClick="insere();"></td>
> </tr>
> <tr><td align="right" class="negrito">Solicitação:</td></tr>
> <tr>
> <td colspan="2">
>
> <TEXTAREA id="solicitacao" Name="solicitacao" rows="10" style="width: 100%;"
> cols="20"></TEXTAREA>
> </tr>
> <tr>
> <td colspan="2">
>
> <div align="center"><input type="submit" name="Submit" value="Enviar"
> id="Submit" /></div></td>
> </tr>
> </table>
> </form>
> </body>
> </html>
>
> O Phyton
>
> from Products.PythonScripts.standard import html_quote
> request = container.REQUEST
> RESPONSE = request.RESPONSE
> mailhost = context.MailHost
> mail_to = "[hidden email]"
> nome_completo = request['nome_completo']
> area_lotacao = request['area_lotacao']
> tipo = request['tipo']
> email_from_address = request['email']
> ramal = request['ramal']
> solicitacao = request['solicitacao']
>
> msg = """
>
> Formulario de Atendimento.
>
> Nome............: %s
> Area de Lotacao.: %s
> Tipo............: %s
> Ramal...........: %s
> E-mail..........: %s
> Solicitacao.....:
> %s
> """ % (nome_completo, area_lotacao, tipo, ramal, email_from_address,
> solicitacao)
>
> #print msg
> #return printed
>
> email_assunto = "Solicitacao de atendimento"
>
> mailhost.send(msg, mail_to, email_from_address, email_assunto)
> return RESPONSE.redirect("http://alguma_pagina")
>
> O erro,
>
> Quando enviado a pagina html q aparece naum recebe os valores
> <TEXTAREA id="solicitacao" Name="solicitacao" rows="10"
>
> Se alguem poder me ajudar ficarei muito grato.
>
>



--
Vanderson Mota dos Santos
kiaskaetano

Re: Envio de Formulario

Reply Threaded More More options
Print post
Permalink
Opa Vanderson,Obrigadoo,

O template e o de baixo mesmo o codigo Phyton,
ele esta enviando. a outras informações,mas quando chega na parte do produtos ele naum recebe nada do que é solicitado, fiz um teste com
tal:content="REQUEST/solicitacao" e tbm não funcionou, vc tem alguma outra ideia?
ah muito obrigado pelo Grok muito legal eu estou vendo aki, vou dar uma estudada nele .

Att,

Ezequias Caetano


--- Em [hidden email], Vanderson Mota dos Santos <vanderson.mota@...> escreveu

>
> Opa, pelo o que tive olhando do seu código, acredito que tenham opções
> em python melhores que Zope para fazer isso:
>
> Django:
> http://www.djangobrasil.org/
> www.aprendendodjango.com
>
> Se quiser permanecer no ecossistema Zope, use o grok:
> http://grok.zope.org/
>
>
> Fazer uma aplicação em Zope "puro" hoje em dia eu acho totalmente antiprodutivo.
>
> Sobre o seu problema,
>
> a template tem que ter os attributos assim:
>
> <TEXTAREA  tal:content="REQUEST/solicitacao" id="solicitacao"
> Name="solicitacao" rows="10" style="width: 100%;"
> cols="20"></TEXTAREA>
>
> Que a template pegará o atributo enviado pelo formulário.
>
>
> Bom, acho que é isso.
>
> abraços!
>
> 2009/7/24 kiaskaetano <kiaskaetano@...>:
> >
> >
> > Boa Noite,
> >
> > Gente estou precisando de uma ajuda, sou novo no Zope e estou com uns
> > problemas pra enviar um formulario, segue o codigo HTMl.
> >
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> > <html metal:use-macro="here/main_template/macros/master">
> > <head>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> > <title>Untitled Document</title>
> > <style type="text/css">
> > <!--
> > .style3 {font-size: large}
> >
> > .formulario_capli {
> > border: 1px solid #000000;
> > }
> >
> > .titulo_capli {
> > font-family:Verdana, Arial, Helvetica, sans-serif;
> > font-size:14px;
> > text-align:center;
> > padding-left:10px;
> > font-weight: bold;
> > }
> >
> > .formulario_capli td {
> > font-family:Verdana, Arial, Helvetica, sans-serif;
> > font-size:12px;
> > text-align:left;
> > padding-left:10px;
> > }
> > .negrito{
> > font-weight:bold;
> > }
> > .lembrete{
> > color:#FF0000;
> > font-size:10px;
> > }
> > -->
> > </style>
> > <script type="text/JavaScript">
> > <!--
> > function MM_jumpMenu(targ,selObj,restore){ //v3.0
> > eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
> > if (restore) selObj.selectedIndex=0;
> > }
> >
> > function insere() {
> > document.form1.solicitacao.value += document.form1.lista.value + '\n\n';
> > }
> > //-->
> > </script>
> > </head>
> >
> > <body metal:fill-slot="main">
> > <form id="form1" name="form1" method="post" action="form.py">
> > <table width="500" border="0" cellspacing="2" cellpadding="0"
> > class="formulario_capli" align="center">
> > <tr>
> >
> > <td colspan="2"><div align="center"><p><img src="capli-logo.jpg" width="191"
> > height="60" /></p></div></td>
> >
> > </tr>
> > <tr>
> > <td colspan="2"><div align="center"><p
> > class="titulo_capli">Solicitação de Material</p></div></td>
> > </tr>
> > </table>
> > <table width="500" border="0" cellspacing="2" cellpadding="5"
> > class="formulario_capli" align="center">
> > <tr>
> > <td width="120px" align="right" class="negrito">Nome Completo:</td>
> > <td>
> > <input id="nome_completo" type="text" name="nome_completo"
> > style="width:300px" size="20"/> </td>
> > </tr>
> > <tr>
> > <td align="right" class="negrito">Área de Lotação:
> > </td>
> > <td><input id="area_lotacao" type="text" name="area_lotacao"
> > style="width:240px" size="20"/></td>
> > </tr>
> > <tr>
> > <td align="right" class="negrito">Ramal:</td>
> > <td>
> > <input id="ramal" type="text" name="ramal" style="width:60px" size="20"
> > /></td>
> > </tr>
> > <tr>
> > <td align="right" class="negrito">E-mail (ITI):</td>
> > <td>
> > <input id="email" type="text" name="email" style="width:240px" size="20"
> > /></td>
> > </tr>
> > <tr>
> > <td align="right" colspan="2">
> > <center><b class="lembrete">Selecione o material desejado e clique no botão
> > abaixo para inserí-lo à lista de solicitação. Não esqueça de indicar a
> > quantidade desejada.</b></center> <br>
> > <SELECT Name="lista" style="width: 100%;" size="10">
> >
> > <OPTION Value="Alfinete mapa, Material metal tratamento superficial
> > niquelado.-- QTD: ">Alfinete mapa, Material metal tratamento superficial
> > niquelado.
> > <OPTION Value="Almofada para carimbo nº 03 cor preta. Marca: POLY.-- QTD:
> > ">Almofada para carimbo nº 03 cor preta. Marca: POLY.
> > <OPTION Value="Almofada para carimbo nº 04 cor azul. Marca: JAPAN SPAN.--
> > QTD: ">Almofada para carimbo nº 04 cor azul. Marca: JAPAN SPAN.
> > <OPTION Value="Apontador de lápis material tipo escolar Plastico
> >
> > </SELECT>
> >
> > </td>
> > </tr>
> > <tr>
> > <td align="right" colspan="2">
> > <p align="center"><INPUT Type="button" Value="Adicionar material à
> > solicitação" onClick="insere();"></td>
> > </tr>
> > <tr><td align="right" class="negrito">Solicitação:</td></tr>
> > <tr>
> > <td colspan="2">
> >
> > <TEXTAREA id="solicitacao" Name="solicitacao" rows="10" style="width: 100%;"
> > cols="20"></TEXTAREA>
> > </tr>
> > <tr>
> > <td colspan="2">
> >
> > <div align="center"><input type="submit" name="Submit" value="Enviar"
> > id="Submit" /></div></td>
> > </tr>
> > </table>
> > </form>
> > </body>
> > </html>
> >
> > O Phyton
> >
> > from Products.PythonScripts.standard import html_quote
> > request = container.REQUEST
> > RESPONSE = request.RESPONSE
> > mailhost = context.MailHost
> > mail_to = "algumemail@..."
> > nome_completo = request['nome_completo']
> > area_lotacao = request['area_lotacao']
> > tipo = request['tipo']
> > email_from_address = request['email']
> > ramal = request['ramal']
> > solicitacao = request['solicitacao']
> >
> > msg = """
> >
> > Formulario de Atendimento.
> >
> > Nome............: %s
> > Area de Lotacao.: %s
> > Tipo............: %s
> > Ramal...........: %s
> > E-mail..........: %s
> > Solicitacao.....:
> > %s
> > """ % (nome_completo, area_lotacao, tipo, ramal, email_from_address,
> > solicitacao)
> >
> > #print msg
> > #return printed
> >
> > email_assunto = "Solicitacao de atendimento"
> >
> > mailhost.send(msg, mail_to, email_from_address, email_assunto)
> > return RESPONSE.redirect("http://alguma_pagina")
> >
> > O erro,
> >
> > Quando enviado a pagina html q aparece naum recebe os valores
> > <TEXTAREA id="solicitacao" Name="solicitacao" rows="10"
> >
> > Se alguem poder me ajudar ficarei muito grato.
> >
> >
>
>
>
> --
> Vanderson Mota dos Santos
>