Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / General CF Topics / July 2008



Tip: Looking for answers? Try searching our database.

Submitting a form to itself

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
trojnfn - 30 Jul 2008 06:01 GMT
When I submit a form, instead of submiting it to an action page, I submit it
back to itself, with all the processing taking place before the form/cfform
statement.

Here is the problem that I am running into. I have radio buttons and use
javascript to check that at least one button is checked. Here is my code and it
works :

<script language="javascript">

function validateForm(editProfileForm){

    var returnStatus = true;

myOption = -1;
    for (i=editProfileForm.profileStatus.length-1; i > -1; i--) {
    if (editProfileForm.profileStatus[i].checked) {
    myOption = i; i = -1;
    }
    }
    if (myOption == -1) {
    alert("Please select active or inactive button.");
    editProfileForm.profileStatu.focus();
     returnStatus(false);
    }
   
    if (returnStatus){
    editProfileForm.submit();
    }
   
    returnStatus(true);
    }
   
</script>
</head>

<body>

But the problem is that as soon as I click ok in the popup message, it goes
down to the next command, which is checking for the submit button being
selected (below). The page then blows up. How would I stop the page from
continuing after the radio button error ? It seems to work if there is an
action page but submitting the form to itself seems to cause this problem.

<!--- If the submit button is selected, process the page below --->
<cfif parameterExists(form.btnSubmit)>
eightcharacters - 30 Jul 2008 06:46 GMT
Would a <cfabort> work?
GArlington - 30 Jul 2008 11:00 GMT
> When I submit a form, instead of submiting it to an action page, I submit it
> back to itself, with all the processing taking place before the form/cfform
[quoted text clipped - 20 lines]
>         editProfileForm.profileStatu.focus();
>       returnStatus(false);
Where (AND WHY) did you define a function returnStatus(boolean)?
I guess that you meant returnStatus =false; here...
>      }
>
[quoted text clipped - 18 lines]
>  <!--- If the submit button is selected, process the page below --->
>  <cfif parameterExists(form.btnSubmit)>
Dan Bracuk - 30 Jul 2008 12:50 GMT
The simplest way is to preselect one radio button when you load the page.
Ian Skinner - 30 Jul 2008 14:29 GMT
What version of ColdFusion are you using?

ParameterExists
Description

This function is deprecated. Do not use it in new applications. Use the
IsDefined function.

Determines whether a parameter exists. ColdFusion does not evaluate the
argument.
History

New in ColdFusion MX: This function is deprecated. Do not use it in new
applications. It might not work, and might cause an error, in later
releases.
http://livedocs.adobe.com/coldfusion/6/CFML_Reference/functions-pt249.htm
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.