Jump to content
Larry Ullman's Book Forums

angelsonearth

Members
  • Posts

    42
  • Joined

  • Last visited

Recent Profile Visitors

1143 profile views

angelsonearth's Achievements

Newbie

Newbie (1/14)

5

Reputation

  1. Dear Larry and friends, Hi there! I hope everyone is well. Please kindly note that I just downloaded XAMPP so that I can work on a video tutorial plus revisit Larry's PHP book series, and I've come across the information that XAMPP won't work due to a blocked port. The Skype function that is blocking the port is invaluable to me as I podcast, so I'm not sure how to change the port for the XAMPP. Please, some kind soul, let me know how to change the port that XAMPP is associated with or find some other solution for getting XAMPP to work. I don't want to mess around with the Skype occupancy of the Port at present. Here is the error message I get when trying to start XAMPP: Apache WILL NOt start without the configured ports free! You need to uninstall/disable/reconfigure the blocking application or reconfigure Apache and the Control Panel to listen on a different port Attempting to start Apach app... Status change detected: running Status change detected: stopped Error: Apache shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a crash, or a shutdown by another method. Press the Logs button to view error logs and check the Windows Event Viewer for more clues.
  2. Hi HartleySans! I hear you! I really needed to learn the ropes of submitting on a forum as this is really my first venture out into the area. Thanks so much for the advice! I implemented the code, and it worked like a charm! Thank you so very much. Truthfully, I'm not sure if I would have stumbled on such an elegant solution if I had just searched the Web for solutions, but I guess banging my head against the wall for weeks on end is a good growth opportunity for me! : ) Thank you so very much for the excellent advice and God bless!
  3. That is the most awesome answer I could have hoped for! Wow! Thanks so much, HartleySans! You are the MAST-AH!! (Larry, too, of course!) Whew!! One quick question from a very amateurish starting point, if I use returnVals.push(regularExpressionMatchFunction("firstName", /^[A-Za-z'\.]+\s*[A-Za-z'\.\s]*$/, "The name must include alphabetical letters \(and can include apostrophes, periods, and spaces\)")); will regularExpressionMatchFunction automatically execute? Thanks for the tip on getting my code to work well in the forum, too, my friend! God bless you!! You saved me hours of defeat and torment! Thank you so very much!
  4. Thanks, HartleySans! Your help is always appreciated! I cleaned up my code more, and here is the next attempt! I am wondering how I can get the return false in the third layer of embedded functions to reach the first to prevent the default behavior of onsubmit for the form. I highlighted the return false and the original calling function both in bold. Thanks so much in advance for any and all help! function regularExpressionMatchFunction(id, regularExpressionMatch, errorMessageText) { //declare variables used in field check. alert("At beginning of function, the regular expression is " + regularExpressionMatch); var flagVariableNoError = true; var fieldName; var fieldNameValue var regExFieldName var finalRegExpressBooleanFieldName var fieldNameValueTrimmed // Get field name and field value fieldName = document.getElementById(id); fieldNameValue = fieldName.value; // TRIM WHITE SPACE Function Called here fieldNameValueTrimmed = trimWhiteSpace(fieldNameValue); alert("My fieldNameValueTrimmed is" + fieldNameValueTrimmed); finalRegExpressBooleanFieldName = regularExpressionMatch.test(fieldNameValueTrimmed); alert("After doing regular expression MATCH, the value of finalRegExpressBooleanFieldName (the boolean) is " + finalRegExpressBooleanFieldName); if (finalRegExpressBooleanFieldName == true) { removeErrorMessage(id); alert("You are an awesome coder!"); } else { addErrorMessage(id, errorMessageText); flagVariableNoError = false; } if (flagVariableNoError = false) { return false; } } function validateFormOnSubmit() { // FIRSTNAME field validation regularExpressionMatchFunction("firstName", /^[A-Za-z'\.]+\s*[A-Za-z'\.\s]*$/, "The name must include alphabetical letters \(and can include apostrophes, periods, and spaces\)"); // VALIDATE LAST NAME regularExpressionMatchFunction("lastName", /^[A-Za-z'\.]+\s*[A-Za-z'\.\s]*$/, "The name must include alphabetical letters \(and can include apostrophes, periods, and spaces\)"); // VALIDATE EMAIL regularExpressionMatchFunction("email", /^[\w.-]+@[\w.-]+\.([A-Za-z]{2,6})+/, "A valid email address is required"); // VALIDATE TELEPHONE regularExpressionMatchFunction("telephone", /^(\()?\d{3}(\))?(-|\s)?\d{3}(-|\s)?\d{4}$/, "Please enter the phone number in any of a variety of formats, including xxx-xxx-xxxx, \(xxx\)xxx-xxxx, \(xxx\) xxx-xxxxx, xxxxxxxxxx, xxx xxx xxxx") // VALIDATE COMPANY NAME regularExpressionMatchFunction("companyName", /^[\w'.&]*\s*[\w'&\s]*$/, "Company names can only contain alphabetical letters, numbers, underscores, '&', and apostrophes"); // VALIDATE COUNTRY NAME regularExpressionMatchFunction("country", /^[A-Za-z'\.]+\s*[A-Za-z'\.\s]*$/, "Country name can only contain letters, periods, apostrophes, and spaces"); } function init(){ var theform = document.getElementById('registerForm'); theform.onsubmit = validateFormOnSubmit; var retypeEmailField = document.getElementById('retypeEmail'); // This is my own coding idea retypeEmailField.onblur = validateEmailMatch; }
  5. Hello, everyone! Please kindly note that I have an event call for form onsubmit. However, the return false to prevent default behavior of the form submission is embedded two functions below, and I'm not sure if it will reach the theform.onsubmit function call. Please help. Here is the original form onsubit function call: var theform = document.getElementById('registerForm'); theform.onsubmit = validateFormOnSubmit; It then goes to a function that checks each field like this, function validateFormOnSubmit() { // FIRSTNAME field validation with the errorMessage brackets escaped regularExpressionMatchFunction("firstName", /^[A-Za-z'\.]+\s*[A-Za-z'\.\s]*$/, "The name must include alphabetical letters \(and can include apostrophes, periods, and spaces\)"); // VALIDATE LAST NAME //This code validates lastName with some text boxes initially implemented to ensure code works properly. // HTML5FieldCheck is not needed here as there is no default text in the lastName field. regularExpressionMatchFunction("lastName", /^[A-Za-z'\.]+\s*[A-Za-z'\.\s]*$/, "The name must include alphabetical letters \(and can include apostrophes, periods, and spaces\)"); And so forth. The regular expressionMatch Function above then calls a function that I set a flag variable in and that checks to see if there is a regular expression match. If the regular expression does or does not match, there is a remove error message and add error message command, respectively. If the code demands that an error message be added, I have set the flagVariableError to false and then follow the function by returning the flag varialble. var flagVariableNoError = true; etc., etc., if (finalRegExpressBooleanFieldName == true) { //removeErrorMessage inserted here will take the element by id field but not an error message as arguments removeErrorMessage(id); alert("You are an awesome coder!"); } else { // addErrorMessage will take the getElementById field "firstName" and also the error message text (the above parameter) as arguments addErrorMessage(id, errorMessageText); // The return false code didn't work in the addErrorMessage function itself, so I'll try it here flagVariableNoError = false; } // This is returning the value of the flagVariableNoError to the form submission event if (flagVariableNoError = false) { return false; } I am not sure that the return false will be recognized by the first form onsubmit calling function at the very top. I believe this is so because the return false command is embedded two functions down, and I'm not sure how to get it to reach the top function: namely, the form onsubmit function at the top here. Please advise!
  6. Thanks, HartleySan! I apologize for my novice programming skills, but it is definitely a relief to know that I don't need to work on this particular function any longer. It appears that placeholder text set in HTML5 doesn't have any bearings on either the default value or the value, which is good for a newby like me to know, for sure! Thanks very much again!
  7. Dear friends (and the ultimate forum friends, Hartley Sans and, of course, the invincible Larry Ullman)! I was wondering why my elem.defaultValue code was pulling up a null value, I believe. I thought the elem.defaultValue would pull up the placeholder text for the HTML5 field. Is this not how it works? Here is my code for the placeholder text: <input type="email" name="email" id="email" placeholder="e.g. someone@server.com" required="required"> And here is my code for the defaultValue function HTML5FieldCheck(id2, regExpToPassOn, errorMessage2) { alert("We are in the HTML5FieldCheck, and the id is " + id2 + "and the regExpToPassOn is" + regExpToPassOn + "and the error message is " + errorMessage2); var elem = document.getElementById(id2); elemValue = elem.value; // defaultValue not recognized as a method elemDefault = elem.defaultValue; alert("The HTML5FieldCheck default value is " + elemDefault); if (elemValue === elemDefault) { alert("The HTML5FieldCheck showed that no entry was made"); addErrorMessage(id, "Please fill out mandatory field"); } else { alert("The HTML5FieldCheck showed that an entry was made"); regularExpressionMatchFunction(id2, regExpToPassOn, errorMessage2); } } Can anyone figure out why the defaultValue is registering as null? Thanks so much!
  8. Hello all (and hopefully Hartley Sans, my dear online friend, too)! Please kindly note that I want to do an automatic PHP (I believe 301) redirect to an amazon site as an affiliate. Is it still possible to use meta description in a page that automatically gets redirected to Amazon. I've never actually uploaded a PHP page. Would I just make a folder with the PHP file in it with the redirect and attach it to the HTML page that gets redirected? Do I have to do anything special at the server end? Also, what would be the code for a simple 301 redirect in PHP? Also, should I use a JavaScript and an HTML redirect along with the PHP redirect, or are they less SEO friendly? So much to ask! Any assistance is a God sent!! Thank you so very much for any and all insights!
  9. Dear Hartley Sans, You are certainly all heart, Hartley Sans, and very, very much appreciated! Between you and Larry Ullman, I think I stand a chance of becoming a serious Web coder one day! Thanks so much, and bless your souls!
  10. Hello there! Please kindly note that I've been staring down this code for days now, and I can't seem to get why the regular expression test method doesn't work (and why Firebug says "it is not a function" when my code skips over everything that deals with the results of the test method). I am trying to create a utility function for form validation that passes in an id and a regular expression. Here is my calling code: regularExpressionMatchFunction("firstName", "/^[A-Za-z'\.]+\s*[A-Za-z'\.\s]*$/"); Here is the code with the erroneous component in bold: function regularExpressionMatchFunction(id, regularExpressionMatch) { //declare variables used in field check. alert("At beginning of function, the regular expression is " + regularExpressionMatch); var fieldName; var fieldNameValue var regExFieldName var finalRegExpressBooleanFieldName var fieldNameValueTrimmed // Get field name and field value fieldName = document.getElementById(id); fieldNameValue = fieldName.value; // TRIM WHITE SPACE Function Called here-- prepare code for trimming off white space on fieldName value fieldNameValueTrimmed = trimWhiteSpace(fieldNameValue); alert("My fieldNameValueTrimmed is" + fieldNameValueTrimmed); // Now for the regular expression, which looks for letters, apostrophes, and periods, although I don't need to escape the period (plus white space // Have to change the fieldNameValue to trimmed version above // HERE IS ERROR HERE IS ERROR HERE IS ERROR // NOT RECOGNIZED AS A FUNCTION finalRegExpressBooleanFieldName = regularExpressionMatch.test(fieldNameValueTrimmed); // EVERYTHING AFTER THE ABOVE CODE JUST GETS SKIPPED OVER, INCLUDING THE FOLLOWING ALERT MESSAGE alert("After doing regular expression MATCH, the value of finalRegExpressBooleanFieldName (the boolean) is " + finalRegExpressBooleanFieldName); // These alerts need to be replaced with calls to addErrorMessage and removeErrorMessage if (finalRegExpressBooleanFieldName == true) { //removeErrorMessage inserted here will take the element by id field but not an error message as arguments removeErrorMessage(id); alert("You are an awesome coder!"); } else { // addErrorMessage will take the getElementById field "firstName" and also the error message as arguments addErrorMessage(id, "The name value must include alphabetical letters (and can include apostrophes, periods, and spaces)"); alert("You code like toodles"); // The return false code didn't work in the addErrorMessage function itself, so I'll try it here return false; } } If anyone can help me figure out why the code breaks at the test method in bold above, I would be most appreciative! Thank you so very much!
  11. Thanks, HartleySan! Your feedback is always appreciated very much!
  12. It also says, "window" is undefined where I have window.onload = init
  13. Thank you so very much for responding, Hartley San! You give such awesome feedback, as I've been privileged to experience. Here is what the error messages said that I could retrieve File not found There are no scripts, but the page is still loading Check the file name for capitalization or other typing errors. Check to see if the file was moved, renamed or deleted. Here is the name of my file: <script type="text/javascript" src="js/formValidationRegister.js"></script> My file is located in a folder js that is in the top folder. The HTML is in the top folder as well.
  14. Thank you so very much for the excellent posts! Please kindly note that I'm trying the above method, but I can't get my alerts to show up in the following code during the onsubmit process! Here is my code (although I think I may have used and declared too many unnecessary variables): function validateFormOnSubmit() { var firstName; var firstNameValue var regExFirstName var finalRegExpressBooleanFirstName firstName = document.getElementById("firstName"); firstNameValue = firstName.value; regExFirstName = /^[A-Za-z'\.]+\s*[A-Za-z'\.]*$/; finalRegExpressBooleanFirstName = regExFirstName.test("firstNameValue"); if (finalRegExpressBooleanFirstName == true) { alert("You Awesome Coder!"); } else { alert("You Code Like Toodles"); } } //Start code for init() taken from http://www.larryullman.com/forums/index.php?/topic/2870-the-form-on-submit/ function init(){ var theform = document.getElementById('registerForm'); theform.onsubmit = validateFormOnSubmit; }; window.onload = init; on my form I just have the id (I got rid of method and any link to a php file, as I wanted to focus on the Javascript). Here is my form structure for the relevant fields: <form id="registerForm" > <fieldset> <legend>Register</legend> <p>A * represents a required field.</p> <div class="field"> <label for="firstName">*First Name:</label> <input type="text" name="firstName" id="firstName" required="required" autofocus="autofocus"> </div> Does anyone know why my code isn't working? (By the way, Larry Ullman is the ultimate teacher of regular expressions, isn't he for sure?) Thank you!
  15. Hello friends. I just started a course in which I need to use libraries for creating a Javascript driven library (with no PHP). I am wondering what applications or features are being coded as examples in this book? (For instance, Larry previously had a stock ticker, which I am needing for a financial site I'm building.) Please kindly advise as to what features are in the book so far (and please forgive me for calling them "features". . . I don't know what the functionalities are technically referred to as). It would be a great heads up to know what I might be able to build with the guidance of this Yii book. Thank you so very much!
×
×
  • Create New...