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

Form Submit not behaving as expected

Guest
Sep 16, 2010 Sep 16, 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>     instanceName = createObject("java", "jrunx.kernel.JRun").getServerName(); </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.

TOPICS
Getting started
593
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 16, 2010 Sep 16, 2010

You say you have a submit button but you don't.  You have a button with an onClick event that runs some javascript.  Try replacing that with a simple input type = "submit" and see if that helps.

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 16, 2010 Sep 16, 2010

Thanks for your reply,

i see the contradicting code.  Prior to posting on this forum, i tried it with a submit button (opposed to button) with out the onclick event java code with same result.  However, that is not what i posted (sorry bout that).  In an act of despiration i tried a lot of things just pulling at straws and that is how the contratiction got post.

Do you have any other suggestions?  Mean time i going to try your suggestion just to get back on track and follow through with your suggestion.

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 16, 2010 Sep 16, 2010
LATEST

In order to see what is causing the problem, I suggest commenting out the existing cfscript.  Replace it with some static text and some code to delay the cflocation.

Then run the page to see if the problem is still there.  If it is, try using metarefresh instead of cflocation and test again.  If possible, use different browsers and/or different computers as well.

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