Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Form submit not behaving as expected

Guest
Sep 08, 2010 Sep 08, 2010

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.

913
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 08, 2010 Sep 08, 2010

one last thing:

CF 8 update 1

IIS 6

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 08, 2010 Sep 08, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 08, 2010 Sep 08, 2010

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

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

thanks for your reply.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 09, 2010 Sep 09, 2010

Can any one direct me to the proper forum....? This seems like a very simple problem and seems like it might not be in the best forum.

thanks again

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 09, 2010 Sep 09, 2010
LATEST

Possibly not, because you're not using a "rich form" here are you?  Really, I can't see why you're using <cfform> at all for a form with a single submit button on it (or is there other stuff on the form you're omitting)?

I doubt it's anything to do with the form side of things: if the form is displaying and the submit process works, that's the end of the form's relevance to the affair.

This is a very low-bandwidth forum... I'd repost in the "getting started" forum.

But some intermediary advice: remove the rest of the code on the action page except for the <cflocation>.  Does it work all the time then?  If so, refactor the other code in in a piecemeal fashion until you find the bit that's causing the issue, then scratch your head and wonder why.  And probably post back to the forum (the "getting started" one, not this one).

--

Adam

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources