SearchSearch   ProfileProfile   Log inLog in   RegisterRegister 

Custom Pages: Question Regarding Page Creation
Goto page Previous  1, 2
 
Post new topic   Reply to topic    FirstSpot Forum Index -> Pre-sales Support Forum
View previous topic :: View next topic  
Author Message
alan
Forum facilitator


Joined: 26 Sep 2003
Posts: 4435

PostPosted: Fri Jun 17, 2011 4:27 pm    
Post subject:

Well, please remove any reference of fs_login.php in alogin_form_body.tpl.

Again, you should keep the original structure of the sample code in chapter 5 of firstspot_guide.pdf.
_________________
~ Patronsoft Limited ~
Back to top
ReverendD



Joined: 08 Jun 2011
Posts: 17

PostPosted: Fri Jun 17, 2011 4:28 pm    
Post subject:

Okay, I have this working now and found where my issue was. For some reason my text editor saved the alogin_form_body.tpl into a local html file instead of saving it back to the tpl file.

I corrected this and tested and it went through the redirect fine and is working.

I tested using an improper email address format just to see however and I did get an error. The error simply states there was an error addressing line 6 of the saveFile.php file (the portion that returns the error for an improperly formatted email). The exact error is below.

Code:
Fatal Error: Call to undefined function show_error() in C:\Program Files\FirstSpot\authserv\
saveFile.php on line 6


Here are the lines from the saveFile.php file:

Code:

Line 3| /* Checks to make sure the email address is in a valid format and no illegal characters */
Line 4| if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $emailAddress))
Line 5|    {
Line 6|       show_error("E-mail address not valid");
Line 7|    }


When using the saveFile.php directly if the email is not properly formatted it displays there error that the email address is not valid. In this case of including it in the fs_login.php file it is producing an error stating it cannot display the error.
Back to top
alan
Forum facilitator


Joined: 26 Sep 2003
Posts: 4435

PostPosted: Mon Jun 20, 2011 5:27 am    
Post subject:

What is the show_error() in php ?

Our suggestion is to use javascript in alogin_form_body.tpl's in your checkForm() [you can put it in the front]:

Code:
// Checks to make sure the email address is in a valid format and no illegal characters
if (!document.loginForm.emailAddress.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/) ){
     alert ('E-mail address not valid');
     return false;
   }

_________________
~ Patronsoft Limited ~
Back to top
ReverendD



Joined: 08 Jun 2011
Posts: 17

PostPosted: Tue Jun 21, 2011 6:57 pm    
Post subject:

The show_error() was a function from a previous email checking script I was using. Since that function was removed it errors out now. So I removed tha entire portion of the email check from the saveFile.php file and added your above code to the alogin_form_body.tpl file. However the email check does not seem to work as it skips past that part of the script. I do have two scripts in my header though, both scripts are below:

Code:

<script type="text/javascript" language=javascript>
// Checks to make sure the email address is in a valid format and no illegal characters
if (!document.loginForm.emailAddress.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/) ){
     alert ('E-mail address not valid');
     return false;
   }
</script>

<script type="text/javascript" language=javascript>
   <!--
   function checkForm()
   {
      if (document.loginForm.acceptTOS.checked == false)
      { alert ('Please agree to the Terms & Conditions before proceeding.');
         return false;
      }
      if (document.loginForm.emailAddress.value == "")
      { alert ('Please enter a valid email address.');
         return false;
      }
         else
      {
         return true;
      }
   }
   //-->
</script>


Both of these are between my <BODY> and first <TABLE> tag in the tpl file.
Back to top
alan
Forum facilitator


Joined: 26 Sep 2003
Posts: 4435

PostPosted: Tue Jun 21, 2011 7:17 pm    
Post subject:

Our idea is to put our javascript code within your checkForm() function. You might need to experiment which part of checkForm should you put our code in.

Please post your exact message if you still have difficulties.
_________________
~ Patronsoft Limited ~
Back to top
ReverendD



Joined: 08 Jun 2011
Posts: 17

PostPosted: Tue Jun 21, 2011 8:01 pm    
Post subject:

Okay, I am getting no more errors, however the script is not working either.

Below is the entire script I have in the alogin tpl file now:

Code:

<script type="text/javascript" language=javascript>
   <!--
   function checkForm()
   {
      if (document.loginForm.emailAddress.value.match(/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/))
      { alert ('Email Address is invalid, please re-enter.');
         return false;
         }
      if (document.loginForm.emailAddress.value == "")
      { alert ('Please enter an email address.');
         return false;
      }
      if (document.loginForm.acceptTOS.checked == false)
      { alert ('Please agree to the Terms & Conditions before proceeding.');
         return false;
      }
         else
      {
         return true;
      }
   }
   //-->
</script>


The form itself on load is completely blank, so it contains nothing. With an empty form if I click on Continue it will give me the second alert from the script, so it has checked that the emailAddress text box is empty and responded to it. From here I can enter in any type of numbers, letters, and symbols and as long as I have the acceptTOS checkbox checked, it will continue and redirect as it should. So the first part of the script to verify the email format is not working at all. I have the code for my form below for review as well.

Code:

      <form name="loginForm" method="post" onSubmit="return checkForm();" action="fs_login.php" style="font-size: 10px;">
         Email Address: <input type="text" value="" size="20" name="emailAddress"><br />
         Attendng Funeral: <input type="text" value="" size="18" name="attendedFuneral"><br />
         Current Date: <input type="text" name="attendedDate" size="10" value=""> <br />
         <input type="checkbox" name="acceptTOS" value="acceptTOS">I Agree with the <a href="../tos.html" target="_blank">Terms & Conditions</a><br /><br />
         <input type="submit" value="Continue" name="anonymous_mode_button">
         <input type="hidden" name="ok_url" value="redirect.php">
         <input type="hidden" name="cart_url" value="alogin_form.php">
         <input type="hidden" name="fail_url" value="alogin_form.php">
      </form>


At this point I am not sure if I am missing something and just can't see it or if something is wrong with the script itself. Right now all the code is just running together. lol

Just as a side note, thank you guys for the assistance on this. I should be setting this up at the customer site on Friday for live testing. If it works like they want they will be purchasing the software.

~Rev
Back to top
ReverendD



Joined: 08 Jun 2011
Posts: 17

PostPosted: Tue Jun 21, 2011 8:16 pm    
Post subject:

Okay,I have it working now and found out why the first portion of the script was not working. I also decided to use a slightly different format. Below is the new code:

Code:

<script type="text/javascript" language=javascript>
   <!--
   function checkForm()
   {
      var emailValidate = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
      
      if (document.loginForm.emailAddress.value.search(emailValidate) == -1)
      { alert ('Email Address is invalid, please re-enter.');
         return false;
      }
      if (document.loginForm.emailAddress.value == "")
      { alert ('Please enter an email address.');
         return false;
      }
      if (document.loginForm.acceptTOS.checked == false)
      { alert ('Please agree to the Terms & Conditions before proceeding.');
         return false;
      }
         else
      {
         return true;
      }
   }
   //-->
</script>


For the new code I changed to using a variable to hold the validation data and the search function on the emailAddress text box. What I found preventing it from working was the opening "{" was after the first if() argument, so it was leaving it out completely. Once I fixed this the script worked. So I was just completely missing that goof up. I have done testing on it with various letters, numbers, symbols, and empty and it seems to be working fine now.

Last thing to do is fix up the redirect page to be in the same format as everything else ad its ready for live. Thanks again for the help Alan.

~Rev
Back to top
alan
Forum facilitator


Joined: 26 Sep 2003
Posts: 4435

PostPosted: Wed Jun 22, 2011 5:23 am    
Post subject:

So is everything okay? Feel free to contact us if you have any further questions.
_________________
~ Patronsoft Limited ~
Back to top
Display posts from previous:   
Post new topic   Reply to topic    FirstSpot Forum Index -> Pre-sales Support Forum All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group