Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. Should I assume that the absence of a response is due to an absence of advice? Does everything really appear OK? You view the webpage here. Please respond. Roddy
  2. BACKGROUND: On one webpage I have two forms and one button for both forms. Each form has its own action pointing to a different PHP processing file. I can get each form to work properly by itself, but I cannot seem to get the perform together. $('.SignUpButton').on('click', function() { $('#student_info').submit(); $('#topic_info').submit(); }); <form id='student_info' method='post' enctype='application/x-www-form-urlencoded' action='./_utilities/php/student_info.php'> ... </form> <form id='topic_info' method='post' enctype='application/x-www-form-urlencoded' action='./_utilities/php/topic_info.php'> ... </form> <input id='passcode_entry' form='student_info' type='text' name='passcode' placeholder='4-Digit Code' /> <button class='SignUpButton'>Sign Up!</button> QUESTION: If you could help me to get the above code to work properly, I would be very grateful. Ideally, I would like to get both forms pointing to the same PHP processing file, but do not know how to combine the data, and I have not a lot of time for a major renovation of my code, as I would very much like to have this up and running by tomorrow morning. By the way, I tried using the form attribute with the <fieldset> element, but for some reason it failed to work properly. Please advise. Roddy
  3. Hi! Thank you for your quick response. As it is my goal to have this page ready and working by Monday, I have selected Ingolme's response as the easiest to implement fix. input, textarea, select { font-size: 16px; } In the end, I have not yet grown accustomed to the use of the vw unit, and still have to build a data base and create the PHP to handle the task of data transport and storage before my self-imposed deadline. Many thanks to both Ingolme and dsonesuk. I am happey to see that you are both still around at W3Schools. Roddy
  4. MOTIVATION: It is sometimes said that time heals all. With this in mind I am hoping that the W3Schools community has advanced since the last time that I communicated and has found a solution to the following problem. BACKGROUND: Recently I created a new webpage that can be found at www.publiustwo.com/ali. If you open this page in an iPhone with a vary narrow viewport such as my own, you will observe that filling in any of the form items that require text input, and in several cases even those that do not, causes the width of the document to increase beyond the size of the available viewport and does not return it to its former size after the input has been completed. QUESTION: It would appear that there are two solutions to this problem: one, prevent the size of the page from expanding in the first place; two, cause the size of the page to retract after the entry has been completed. Has anyone found a solution to this problem" Roddy
  5. Have you tried inserting the following var_dump($query); after the expression $query = $select ->fetch(); to see, if anything is contained therein? Roddy
  6. BACKGROUND: I have an HTML document whose <html> element is tagged with an event icon (EV) when viewed in Firefox's Inspector panel. The <html> has no properties of its own. When one clicks on the event tag one can read the following: The above code appears to refer to a Matomo script placed inside the documents <html> tag at the bottom of the page. The phrase itself is followed by two buttons called Bubbling and Dom2. When one clicks on either a drop-down panel appears with the following code function af() { var al; m = true; aa("unload"); if (r) { do { al = new Date() } while (al.getTimeAlias() < r) } } QUESTION: Can you explain this phenomenon? What is going on? Roddy
  7. Yes, I see. A visitor may wish to view the page in a language different from that of his own browser. Is this what you mean? Roddy
  8. Got it! Thanks. But, you did not answer my first question in the last entry. Is the result not the same? Roddy
  9. OK. But, would you not agree that both longhand interpretations produce the same result? Also, how did you get to $str_browser_language = ''; and $str_browser_language = $str_browser_language; Roddy
  10. CHALLENGE (WELL, KIND OF): Please find below two sets of code. The first is a short-hand snippet of code fits that within a larger block of code. The second is my own long-hand interpretation of what it means. SHORT-HAND: $str_browser_language = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : ''; $str_browser_language = !empty($_GET['language']) ? $_GET['language'] : $str_browser_language; LONG-HAND: if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $str_browser_language = strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ','); } else { if (!empty($_GET['language'])) { $str_browser_language = $_GET['language']; } else { $str_browser_language = ''; } } QUESTION: Is my interpretation correct? If not, please explain, in what manner I have erred. Roddy
  11. I can do as you suggest, but have no idea why it would change anything. The Custom Search functionality for Newsletter, Podcast, and Q&A is, with the exception of several variable names and values, identical. What changes is only the content that is uploaded only after a match has been made. The problem occurs before any match is made occurs on only to of the three search engines. Roddy
  12. I have scoured the relevant page -- namely, overview.html -- and can find no difference. I am at a complete loss. Roddy
  13. BACKGROUND: I use phpMailer in multiple locations or multiple purposes on my website. For example, sometime it is a mass mailing that requires a connection to my MySQL data base, sometimes it is a simple one-on-one communication between me and a new visitor, sometimes the sender is newsletter@grammarcaptive.com, and other times the sender is admin@grammarcaptive.com, etc. Now, I develop in a folder that is a subdomain of the main domain of my webpage. As a result, the path to my Composer installation is different for my development and production sites, and I cannot simply copy from my subdomain to my main domain and expect anything to work. In order to avoid the resulting path problem I would like to extend the phpMailer class. In addition, I would like to avoid the redundancy of copy and paste for everything required to make phpMailer work. For example, one can expect that SMTP server settings will always be the same and the reply recipient is not expected to change. Further, the data base when it is used will always be the same, even though the table is likely to change. REQUEST: Could you sketch in code form what a plausible class arrange would be? NOTE: That last time i tried this it failed, for a lack of a proper outline. Roddy
  14. You appear to have left out the href attribute. Try the following: document.write('<a href="' + link + '" target="_blank"><img src="' + adBanner + '" width="125" height="125" alt="' + alt + '" title="' + title + '" /></a>'); Roddy p.s. If it helps, hover over the heart and click on the trophy that results.
  15. BACKGROUND: I have, somewhat miserably, copied code from one document to another and changed a word in multiple locations in the copied code in an effort to adapt to a different environment. Unfortunately, the result of the copied code is not identical with the result of the code that was copied. Now, there are obvious places to look for the discrepancy, and this I have surely done. Still, I can not find the source of the discrepancy. In an effort to duplicate my frustration, please follow the steps below: STEP ONE: Open to the Grammar Captive mainpage. STEP TWO: Find the navigation bar on your left and the menu item named Local Search. STEP THREE: Click on the word Newsletter. STEP FOUR: Enter into the appropriate box the number of the word-number phrase and click on the SEARCH button. DO NOT enter a keyword! STEP FIVE: Watch how the main content scrolls to the bottom of the respective div. STEP SIX: Repeat STEPS ONE thru FOUR, but in STEP THREE, click on the word Podcast. STEP SEVEN: Notice the absence of scrolling. This is the preferred behavior. QUESTION: What is causing the div to scroll in the one case, but not the other? Roddy
  16. Your suggestion about invoking the reset function when the div is loaded works, but it also seems to render a lot of the rest of what I did worthless. Now, I have to figure out what to eliminate. Roddy
  17. "BACKGROUND: I have a page that, when loaded, creates several values via PHP. These values are assigned to several Javascript variables on the same page. I have verified that the assignment succeeds.  When a visitor clicks on the page a visible div on the page is filled with the content of another div on the same page page, and additional javascript and CSS are loaded from another document."  Roddy
  18. Yes. The reset button sets the captcha question and answer after the search div has been already loaded. The original question and answer are determined when the page is loaded. The functionality is similar, but the activation is different. The reset button uses AJAX to trigger the generation of the question and answer. The initial setting does not. This latter is generated with PHP built into the main page. Roddy
  19. OK. I have uploaded the problem to the internet. Please proceed as follows to discover the source of the problem. STEP ONE: Open to the Grammar Captive mainpage. STEP TWO: Find the heading Local Search in the navigation bar and click on the menu option Newsletter. STEP THREE: Find the Captcha fieldset and click on the Reset Button . STEP FOUR: Play to your heart's content. Everything is, at minimum, functional. STEP FOUR: Repeat STEPS ONE and TWO. STEP FIVE: Skip STEP THREE and proceed to STEP FOUR. This is where the problem arises. It is because the condition of the if-statement in the following code fails. The value of captcha_sa is returned undefined. function submitForm(confirmCode, event) { var visitorConfirmation = confirmCode; console.log('visitorConfirmation: ' + visitorConfirmation); if (visitorConfirmation == captcha_sa) { var search_letter_input = $("input#letter_input").val(); if (search_letter_input == "") { // $("#letter_input_error").show().append('<br />'); var inputError = $("#letter_input_error").html(); $(".MissingEntry").css('display', 'block'); $('.CaptchaSuccess').css('display', 'none'); $('.CaptchaError').css('display', 'none'); $('.CaptchaInstruction').css('display', 'none'); $("#letter_input").focus().focusout(function() { $("#letter_input_error").hide(); }); } else { $('.CaptchaSuccess').css('display', 'block'); $('.CaptchaError').css('display', 'none'); $('.CaptchaInstruction').css('display', 'none'); $(".MissingEntry").css('display', 'none'); event.preventDefault(); findAndDisplay_letter(search_letter_input); } $('.CaptchaError').css('display', 'none'); $('.CaptchaInstruction').css('display', 'none'); event.preventDefault(); findAndDisplay_letter(search_letter_input); } else { $('.CaptchaError').css('display', 'block'); $('.CaptchaSuccess').css('display', 'none'); $('.CaptchaInstruction').css('display', 'none'); event.preventDefault(); findAndDisplay_letter(search_letter_input); } } SOURCE: https://www.grammarcaptive.com/_utilities/javascript/search_letter.js Roddy
  20. Yes, it is likely a problem of scope, because I can get it to work, if I generate the variable after the additional script has loaded. I need, however, to have the value already in place and available, before the additional code is run. Is there someplace that I can store it to make it available at any time? Roddy
  21. BACKGROUND: I have a page that, when loaded, creates several values via PHP. These values are assigned to several Javascript variables on the same page. I have verified that the assignment succeeds. When a visitor clicks on the page a visible div on the page is filled with the content of another div on the same page page, and additional javascript and CSS are loaded from another document. I have verified that this latter load does succeed, and that at least one of the functions contained therein is accessible. DILEMMA: Unfortunately, this freshly loaded Javascript is unable to find the values of the Javascript variables to which the PHP values were assigned when the page was initially downloaded. QUESTION ONE: What are the plausible reasons for not being able to find the relevant variables? QUESTION TWO: How do I make them findable? Roddy
  22. iwato

    A Problem of Scope

    Very nice. Have a great weekend! Roddy
  23. iwato

    A Problem of Scope

    DILEMMA: What I would like following function to do is keep iterating until it has satisfied the condition: abs($random_lum - $contrast_lum) > $lum_differential What it does instead is return NULL and stops, when it is unable. function select_color_pair($base, $lum_differential =0.25){ $color_pair = array(); $result = array( 'rgb' => [], 'hex' => '' ); for( $i=0; $i<3; $i++ ){ $rand = mt_rand(0, 255); $result['rgb'][] = $rand; $dechex = dechex($rand); if(strlen($dechex) < 2){ $dechex = '0' . $dechex; } $result['hex'] .= $dechex; } if ($base == true) { $random_lum = COLOR::fromRGB($result['rgb'])->getLuminance(); $contrast_color = COLOR::fromRGB($result['rgb'])->invert(); $contrast_lum = COLOR::fromHex($contrast_color)->getLuminance(); if (abs($random_lum - $contrast_lum) > $lum_differential) { $random_color = COLOR::fromRGB($result['rgb'])->getHex(); return $color_pair = ['text_color' => $random_color, 'bg_color' => $contrast_color]; } else { select_color_pair($base); } } else { $random_lum = COLOR::fromHex($result['hex'])->getLuminance(); $contrast_color = COLOR::fromHex($result['hex'])->invert(); $contrast_lum = COLOR::fromHex($contrast_color)->getLuminance(); if (abs($random_lum - $contrast_lum) > $lum_differential) { return $color_pair = ['text_color' => strtoupper($result['hex']), 'bg_color' => strtoupper($contrast_color)]; } else { select_color_pair($base); } } } Any suggestions? Roddy
  24. Yes, it works! Hooray! Hooray! Roddy
  25. iwato

    A Problem of Scope

    function select_color_pair($lum_differential, $base = true, $type = true) { function random_color($base, %type){ ... Do something with $base and $true } } QUESTION: Is the second appearance of the parameters $base and $type necessary? Roddy
×
×
  • Create New...