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

Submitting a form to itself

Participant ,
Jul 29, 2008 Jul 29, 2008
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 .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)>

493
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
Jul 29, 2008 Jul 29, 2008
Would a <cfabort> work?
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 ,
Jul 30, 2008 Jul 30, 2008
The simplest way is to preselect one radio button when you load the page.
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 ,
Jul 30, 2008 Jul 30, 2008
LATEST
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
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