A shortcut for submit twice?

Reply

Join Date: Mar 2008
Posts: 5
Reputation: Hercf is an unknown quantity at this point 
Solved Threads: 0
Hercf Hercf is offline Offline
Newbie Poster

A shortcut for submit twice?

 
0
  #1
Aug 4th, 2008
Hi guys!
I need your help!
The next script is a normal “insert page” which get back the “GENERATED_KEY”: “myid” and put it hidden form:”myid”.
If the value of “myid” is numeric then the action attribute of “form1” get a page address as value.
The issue is, it shows 2 times the insert page. You have to push 2 times the “submit” button to receive the desired page.
Is it a way to shortcut these repetitive submit?

  1. <cfparam name="email" default="">
  2. <cfparam name="lname" default="">
  3. <cfparam name="fname" default="">
  4. <cfparam name="myAdress" default="">
  5. <cfparam name="myid" default="">
  6. <cfif isNumeric("#myid#")>
  7. <cfset myAdress ="workform.cfm">
  8.  
  9. <cfelse>
  10. <cfif isDefined("form.email")>
  11. <cfquery datasource="myData" result="myid">
  12. INSERT INTO myTable
  13. (email, lname, fname)
  14. VALUES
  15. ('#form.email#', '#form.lnume#', '#form.fname#')
  16. </cfquery>
  17. <cfset #form.myid#="#myid.GENERATED_KEY#">
  18. <cfdump label="Result Structrure" var="#form#"/>
  19. </cfif>
  20. </cfif>
  21. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  22. <html xmlns="http://www.w3.org/1999/xhtml">
  23. <head>
  24. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />
  25. <title>Register</title>
  26. </head>
  27.  
  28.  
  29. <body>
  30. <cfform name="form1" id="form1" method="post" preservedata="yes" action="#myAdress#">
  31.  
  32.  
  33. </p>
  34. <p>
  35. <label for="email">Email:</label>
  36. <cfinput type="text" name="email" id="email">
  37. </p>
  38. <p>
  39. <label for="lname">Last name:</label>
  40. <cfinput type="text" name="lname" id="lname">
  41. </p>
  42. <p>
  43. <label for="fname">First name</label>
  44. <cfinput type="text" name="fname" id="fname">
  45. </p>
  46. <p>
  47. <cfinput type="hidden" name="myid">
  48. <cfinput type="submit" name="submit" id="submit" value="OK!">
  49. </p>
  50. </cfform>
  51. <p>&nbsp;</p>
  52.  
  53. </body>
  54. </html>
Last edited by peter_budo; Aug 4th, 2008 at 5:30 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ColdFusion Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC