Fala Jeff
beleza? Eu sei... mas o X do "pobrema" � fazer o
update depois. Como fazer o update dos campos que
foram alterados? Olha como eu acabei resolvendo esse
lance:
<CFIF IsDefined('form.departamentoID')>
<cfoutput>
<cfloop list = "#Form.departamentoID#" index =
"ID">
<cfset thisField = "departamento_" & ID>
<cfquery name="updateDeptos"
datasource="#Application.dsn#">
UPDATE
empresas_deptos
SET
empresas_DeptoDescr="#Form[thisfield]#"
WHERE empresas_DeptosID="#ID#"
</cfquery>
</cfloop>
</cfoutput>
</CFIF>
Rodou beleza agora?
--- Jefferson Petilo <[EMAIL PROTECTED]> escreveu:
> Cara eu simplificaria esse c�digo ao m�ximo da
> seguinte forma :
>
>
> <form action="" method="post" name="teste">
> <tr>
> <td>
> <input type="hidden" maxLength="30" size="100"
> name="departamentoID"
>
value="0550EA15-795D-1267-36B0D328F38698EE||Contabilidade"><BR>
> <input type="hidden" maxLength="30" size="100"
> name="departamentoID"
>
value="0550EA29-795D-1267-318AF5DE0E50B206||Financeiro"><BR>
> <input type="hidden" maxLength="30" size="100"
> name="departamentoID"
> value="0550EA33-795D-1267-33AEDC6D486EBC2C||Ger�ncia
> de Sinistros"><BR>
> <input type="hidden" maxLength="30" size="100"
> name="departamentoID"
> value="0550EA3D-795D-1267-3551A63732E2FEFD||Ger�ncia
> de Projetos"><BR>
> </td>
> </tr>
> <input type="submit">
> </form>
>
> <cfdump var="#form#" />
>
> <cfif IsDefined('form.departamentoID')>
> <cfoutput>
> <cfloop index="j" list="#form.departamentoID#"
> delimiters=",">
> C�digo : #ListFirst( j,'||')# - Descri��o :
> #ListLast( j,'||')# <br>
> </cfloop>
> </cfoutput>
> </cfif>
>
>
> Eu acho que dessa forma poderia ficar melhor...
>
> Porque se voc� tentar criar vari�veis com caracteres
> que n�o s�o permitidos
> voc� vai ter muitos problemas.
>
>
> ________________________________
>
> Jefferson de Ara�jo Petilo
> [EMAIL PROTECTED]
>
>
> KM&M Engenharia de Sistemas
> Rua Couto Magalh�es, 228 - Nova R�ssia
> CEP 84.070-080 - Ponta Grossa - PR
> Tel: (42) 223 3037 - Fax: (42) 223 3067
> http://www.kmm.com.br
>
>
> -----Mensagem original-----
> De: ColdFusion Lists
> [mailto:[EMAIL PROTECTED]
> Enviada em: sexta-feira, 11 de junho de 2004 10:32
> Para: [EMAIL PROTECTED]
> Assunto: [cf-brasil] Update naum roda
>
> Mo�ada
>
> bom dia.
>
> Tenho um form de update onde mostro assim:
>
> <TR> <TD>
>
> <INPUT type="hidden" class=fields
> name="departamentoID"
> value="0550EA15-795D-1267-36B0D328F38698EE"><BR>
> <INPUT class=fields maxLength=30 size=50
>
name="departamento_0550EA15-795D-1267-36B0D328F38698EE"
> value="Contabilidade"><BR>
>
> <INPUT type="hidden" class=fields
> name="departamentoID"
> value="0550EA29-795D-1267-318AF5DE0E50B206"><BR>
> <INPUT class=fields maxLength=30 size=50
>
name="departamento_0550EA29-795D-1267-318AF5DE0E50B206"
> value="Financeiro"><BR>
>
> <INPUT type="hidden" class=fields
> name="departamentoID"
> value="0550EA33-795D-1267-33AEDC6D486EBC2C"><BR>
> <INPUT class=fields maxLength=30 size=50
>
name="departamento_0550EA33-795D-1267-33AEDC6D486EBC2C"
> value="Ger�ncia de Sinistros"><BR>
>
> <INPUT type="hidden" class=fields
> name="departamentoID"
> value="0550EA3D-795D-1267-3551A63732E2FEFD"><BR>
> <INPUT class=fields maxLength=30 size=50
>
name="departamento_0550EA3D-795D-1267-3551A63732E2FEFD"
> value="Ger�ncia de Projetos"><BR>
>
> </TD></TR>
>
>
> O cliente faz a sua atualiza��o e quando vou dar o
> update no SQL ele d� pau,
> na verdade pau no Evaluate.
> Olha o SQL:
>
> <CFIF IsDefined('form.departamentoID')>
>
> <cfloop list = "#Form.FieldNames#" index =
> "ThisField"> <cfif
> LEFT(ThisField,13) Is "departamento_"> <cfoutput>
> ThisField= #ThisField#<BR>
> Right=
>
#RIGHT(ThisField,(LEN(ThisField)-13))#<br>#evaluate("#thisfield#")#
> </cfoutput>
> </cfif>
> </cfloop>
>
> </CFIF>
>
>
> O erro do CF:
>
> "795D," on line 1, column 23, is not a valid
> identifer name.
> The CFML compiler was processing:
>
> an expression beginning with
> "DEPARTAMENTO_0550EA15", on line 1, column
> 1.This message is usually caused by a problem in the
> expressions structure.
>
> O que pode ser? Como pegar o valor do campo em
> ThisField?
>
>
> Obrigado
>
> =====
> Diga-me e eu esquecerei
> Mostre-me e lembrarei
> Ensina-me e aprenderei
>
>
______________________________________________________________________
>
> Participe da pesquisa global sobre o Yahoo! Mail:
> http://br.surveys.yahoo.com/global_mail_survey_br
>
>
>
>
>
>
>
>
=====
Diga-me e eu esquecerei
Mostre-me e lembrarei
Ensina-me e aprenderei
______________________________________________________________________
Participe da pesquisa global sobre o Yahoo! Mail:
http://br.surveys.yahoo.com/global_mail_survey_br
--^----------------------------------------------------------------
This email was sent to: [EMAIL PROTECTED]
EASY UNSUBSCRIBE click here: http://topica.com/u/?b1dnXn.b7M5gI.YXJxdWl2
Or send an email to: [EMAIL PROTECTED]
For Topica's complete suite of email marketing solutions visit:
http://www.topica.com/?p=TEXFOOTER
--^----------------------------------------------------------------