Skip to main content
September 8, 2010
Question

Form submit not behaving as expected

  • September 8, 2010
  • 1 reply
  • 992 views

I have a form that has a submit button.  The action page is action.cfm.  Action.cfm executes cfscript to restart a cfusion server instance.  While the restart code is working, the problem i have is at the end of the action.cfm when i cflocation back to the initial form page.  The problem is that when i click the submitt button a second time it does not work.  If i click the submit button a thrid time it does work.  The pattern that emerges is that every other click works after the first click.

I have looked at page caching and other things i have found on the net that look as though could be the problem, but what i think this boils down to is that my understanding of the fundamentals is not where it needs to be for form submissions.  I have also tired self submitting form, which i had no luck with either.  Again, probably my bad but i am open to best practice and ease of use suggestions.

Any help is greatly appreciated.  Thanks in advance.

The code below is in a file named restartit.cfm

<cfform name="myform" action="http://123.456.789.123:8301/restart.cfm" method="post">

<cfinput type ="button" onclick="document.myform.submit();" name="fbutton" value="restart">

</cfform>


Here is restart.cfm


<cfscript>

     //relevant code here

</cfscript>


<cflocation url="http://123.456.789.123:8301/restartit.cfm" addtoken="no">


recap:

goto restartit.cfm and you will see a button.  click the button the restart.cfm is run and cflocation back to restartit.cfm.  This time when clicking on the button, it does not restart the server.  Click it again, and it will restart the server.

Fyi, this is not restarting the server that it is hosinting the page.  It is a different server instance killing a different server.

    This topic has been closed for replies.

    1 reply

    September 8, 2010

    one last thing:

    CF 8 update 1

    IIS 6

    Inspiring
    September 8, 2010

    First you should figure out if this is client side issue or a server side issue.

    Have you checked the web server logs to verify that every button click results in a POST to the restart page?  If not you have may a client side issue.

    Can you post more of your server code?  It hard to offer advice based on the limited amount of code you've posted.

    September 8, 2010

    There is literally one line that goes between the script tags:

    instanceName = createObject("java", "jrunx.kernel.JRun").getServerName();

    thanks for your reply.