Pages that call themselves

Results 1 to 5 of 5

Thread: Pages that call themselves

  1. #1
    S. Duke Guest

    Default Pages that call themselves

    How do you get an ASP page that calls itself rather than another page to process code only if the SUBMIT button has been pressed and not the REFRESH button of the browser? I am using a form on an ASP page that calls itself as the ACTION parameter. I want the code only to process the page as a result of hitting the SUBMIT button and not the refresh button. My attempts to change the value of a hidden value in the form in order to create an IF decision are not working. When I hit the refresh button, files get processed that I don't intend to update or read.

  2. #2
    Join Date
    Dec 1969
    Los Angeles, CA

    Default RE: Pages that call themselves

    Well it all depends on your code<BR><BR>when you submiot pass parameters and then check for those parameters BEFORE you process anything<BR><BR>or better yet<BR><BR>just check for <BR><BR>If REQUEST.form("SomeControlName") then<BR>....<BR>&#039;do your processing here<BR>.....<BR>end if

  3. #3
    S.Duke Guest

    Default RE: Pages that call themselves

    By the way. I know I can put the form on a separate page. I just want to make it work with the page calling itself, if I can.

  4. #4
    S. Duke Guest

    Default RE: Pages that call themselves

    Thank you for a prompt response. My problem is what happens after the initial submit. <BR><BR>The relevant parts of my page looks like what follows:<BR><BR>The initial value of the hidden field is like this:<BR>&#060;INPUT TYPE="hidden" NAME="hidNoRefresh" VALUE="0"&#062;<BR><BR>When I hit the button control, I use an onClick event that changes the value of hidNoRefresh to 1. Then I invoke the submit method of the form, all using JavaScript.<BR><BR>The value of the hidNoRefresh form element is then checked using the IF pattern you describe. <BR><BR>IF CInt(Request.Form("hidNoRefresh")) = 1 THEN<BR><BR>&#039; ---- process code<BR><BR>END IF<BR><BR>I then get an updated version of my ASP page that shows the results of the code within the if block. <BR>After the initial submit:<BR> <BR>If I use the submit button of a form to send the value of a chosen option in a SELECT element, I have no trouble. <BR><BR>But, if I hit refresh, the file reading/writing code I use gets processed again. I don&#039;t want that.<BR><BR>I have changed the value of the hidNoRefresh form element to "0" once the initial code from the submit has processed using a variable, like so:<BR><BR>&#060;INPUT TYPE="hidden" NAME="hidNoRefresh" VALUE="&#060;% = hid %&#062;"&#062; <BR><BR>But, when I hit refresh, the value of 1 is still sent through, causing the code to be processed again.<BR><BR>I have tried to use an onLoad function in JavaScript to set the value of the hidden field to 0 using the following pattern:<BR><BR>document.fileControl.hidNoRefresh. value = "0"; <BR><BR>But, when I hit refresh, the page still reads "1" for the value of the hidNoRefresh element.<BR><BR><BR>No matter what I have done to set the value of hidNoRefresh to 0, the value of 1 still gets passed along to the ASP code when I hit the browser&#039;s refresh button. This, even though the HTML code shows . . . VALUE="0".<BR><BR><BR>I&#039;ve wondered if using a session variable would help. But, initially, I can&#039;t see how to use a session variable to distinguish between a refresh button in a browser and an submit button in a form.<BR><BR>I know all these problems would go away if my form and my code processing were on different pages. But I won&#039;t rest until I know for sure if there is a way to accomplish this using a page that calls itself to process the contents of a form.<BR><BR>Thanks<BR>

  5. #5
    yls Guest

    Default RE: Pages that call themselves

    form method="post" action="filename where you want the page to post to"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts