Question
Submitting a form to itself
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)>
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)>
