Jump to content

[SOLVED] Form doesnt submit if validated


dezkit

Recommended Posts

My form doesn't submit if it is validated.

 

      function checkpostal(){
            var themessage = "You are required to complete the following fields: ";
            var re5digit="STEAM_[0|1]:[0|1]:[0-9]+";
            if (document.form.os1.value.search(re5digit)==-1){
            alert('Please enter a valid SteamID.\nSteamID has to be in the form of "STEAM_0:x:xxxxx"');
            } else {
            return true;
            }
      }

 

anyhelp?

Link to comment
https://forums.phpfreaks.com/topic/110852-solved-form-doesnt-submit-if-validated/
Share on other sites

I think on the form you would add

<form onsubmit="return checkpostal()" name="steamid_form">

 

and in function checkpostal() you would have

 

document.steamid_form.submit()  instead of return true;

 

if anything, I would think that you would need the "return checkpostal()".

We would need to see the form code to be sure, and test ourselves.

<SCRIPT TYPE="text/javascript">
      function checkpostal(){
            var themessage = "You are required to complete the following fields: ";
            var re5digit="STEAM_[0|1]:[0|1]:[0-9]+";
            if (document.form.os1.value.search(re5digit)==-1){
            alert('Please enter a valid SteamID.\nSteamID has to be in the form of "STEAM_0:0:123456"\nIf you do not know how to find your SteamID, press on the HELP? link.');
            } else {
            document.form.submit()
            }
      }
</script>

 

solved.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.