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

Page with MM_editAction wont work in Firefox on form submit..

Explorer ,
Jan 12, 2008 Jan 12, 2008
Hi Guys,

I have a form that adds a record to my database and the user uses this to apply for membership.. there are some scripts that check usernames ect... This all works in IE

But In firefox it fails when the Jacascript tries to submit the form after it checks the fields are OK and it does nothing??

If i fill the form in with errors in my application my javascript is running and picking up the errorrs and tells the user and I have alerts in there now and I can see the javascript is fine right up to the last line and its just the usuall way to submit a form I guess??


Code:
// My checking function is here....
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form
// If all was OK then this fires in the else statment...

else
{
event.returnValue=true;
alert('All Fields OK'); // alert just for my benifit to see if im getting to this point.
document.form2.submit();

}

My script does its checks and the forms action has this to add the record...

<form method="POST" action="<%=MM_editAction%>" name="form2" id="form2">

So the user fills in my form and hits submit and nothing happens unless you use Internet Explorer? In firefox I dont get the alert box firing the message "'All Fields OK'" even though they are all filled in OK and no form gets submitted??

If anyone can help me figure this out id be greatfull.

Thank you
TOPICS
Server side applications
609
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

correct answers 1 Correct answer

Explorer , Jan 13, 2008 Jan 13, 2008
Thank Mick
Translate
LEGEND ,
Jan 12, 2008 Jan 12, 2008
webstaffuk wrote:

> Hi Guys,
>
> I have a form that adds a record to mt database and the user uses this to
> apply for membership.. there are some scripts that check usernames ect... This
> all works in IE
>
> But In firefox it fails when the Jacascript tries to submit the form after it
> checks the fields are OK and it does nothing??
>
> If i fill the form in with errors in my application my javascript is running
> and picking up the errorrs and tells the user and I have alerts in there now
> and can see the javascript is fine till the last line and its just the usuall
> way to submit a form I guess??
>
>
> Code:
>
> // If the script gets this far through all of your fields
> // without problems, it's ok and you can submit the form
>
> else
> {
> event.returnValue=true;
> alert('All Fields OK'); // alert just for my benifit to see if im getting
> to this point.
> document.form2.submit();
>
> }
>
> My script does a check and the forms action has this
>
> <form method="POST" action="<%=MM_editAction%>" name="form2" id="form2">
>
> So the user fillins in my form and hits submit and nothig happens unless you
> use Internet Explorer?
>
> If anyone can help me figure this out id be greatfull.


Need to see the whole scipt. And are you using a submit button named
"submit"?
Mick
>
> Thank you
>
>
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
Explorer ,
Jan 12, 2008 Jan 12, 2008
Hi Mick..
My button is just named "Button" could this be a problem as its of the type button?

Anayway here is my Javascript that checks my forms elements..

<script type="text/javascript">
<!--

function checkForm()
{
alert('Into Check Function');
TxtName=form2.Name.value;
TxtUserName=form2.Username.value;
TxtPassword=form2.Password.value;
TxtEmail=form2.email.value;
TxtLocation=form2.location.value;
TxtDescription=form2.description.value;
TxtFavFood =form2.FavFood.value;

if (TxtName=='')
{
alert('Your Name is a required field. Please try again.');
form2.Name.focus();
event.returnValue=false;
}
else if (TxtUserName=='')
{
alert('Your Username is a required field. Please try again.');
form2.Username.focus();
event.returnValue=false;
}
else if (TxtPassword=='')
{
alert('Your Password is a required field. Please try again.');
form2.Password.focus();
event.returnValue=false;
}
else if (TxtFavFood=='')
{
alert('You need to answer what your favorite food is for a later password reminder');
form2.FavFood.focus();
event.returnValue=false;
}
else if (TxtEmail=='')
{
alert('Your Email Address is a required field. Please try again.');
form2.email.focus();
event.returnValue=false;
}

else if (echeck(TxtEmail)==false)
{
form2.email.focus();
event.returnValue=false;
}
else if (TxtLocation=='')
{
alert('Your Location is a required field. Please try again.');
form2.location.focus();
event.returnValue=false;
}
else if (TxtDescription=='')
{
alert('Your Reason For Joining is a required field. Please try again.');
form2.description.focus();
event.returnValue=false;
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form
else
{
event.returnValue=true;
alert('All Fields OK'); // This bit never fires in firefox ????
document.getElementById("form2").submit() // Tried this to see if it made a change?
//window.document.form2.submit(); // This was my origonal submit.
}

}

// -->
</script>

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 ,
Jan 13, 2008 Jan 13, 2008
webstaffuk wrote:

> Hi Mick..
> My button is just named "Button" could this be a problem as its of the type
> button?
>
> Anayway here is my Javascript that checks my forms elements..
>
function checkForm(){
alert('Into Check Function');
TxtName=document.form2.Name.value;
TxtUserName=document.form2.Username.value;
TxtPassword=document.form2.Password.value;
TxtEmail=document.form2.email.value;
TxtLocation=document.form2.location.value;
TxtDescription=document.form2.description.value;
TxtFavFood =document.form2.FavFood.value;

if (!TxtName){
alert('Your Name is a required field. Please try again.');
document.form2.Name.focus();
return false;
}
if (!TxtUserName){
alert('Your Username is a required field. Please try again.');
document.form2.Username.focus();
return false;
}
if (!TxtPassword){
alert('Your Password is a required field. Please try again.');
document.form2.Password.focus();
return false;
}
if(!TxtFavFood){
alert('You need to answer what your favorite food is for a later
password reminder');
document.form2.FavFood.focus();
return false;
}
if (!TxtEmail){
alert('Your Email Address is a required field. Please try again.');
document.form2.email.focus();
return false;
}
if (!echeck(TxtEmail)){
document.form2.email.focus();
return false;
}
if (!TxtLocation){
alert('Your Location is a required field. Please try again.');
document.form2.location.focus();
return false;
}
if (!TxtDescription){
alert('Your Reason For Joining is a required field. Please try again.');
document.form2.description.focus();
return false;
}
alert('All Fields OK');
document.form2.submit();
}
</script>

Mick
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
Explorer ,
Jan 13, 2008 Jan 13, 2008
LATEST
Thank Mick
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