Jump to content


  • Content count

  • Joined

  • Last visited

  • Days Won


Everything posted by dsonesuk

  1. dsonesuk

    few checkbox checked, but count as one

    If you mean three different attribute named grouped value checkbox inputs of three of each <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0"> <title>Document Title</title> <style> #wrap {width: 20%; margin: 0 auto;} form {border:3px solid #ccc; padding: 15px; margin: 10px;} .single-count{} </style> </head> <body> <div id="wrap"> <form name="myForm" action="#"> <label>chkboxGrp1</label> <input class="single-count" type="checkbox" name="chkboxGrp1[]" value="1" /> <input class="single-count" type="checkbox" name="chkboxGrp1[]" value="2" /> <input class="single-count" type="checkbox" name="chkboxGrp1[]" value="3" /> <hr> <label>chkboxGrp2</label> <input class="single-count" type="checkbox" name="chkboxGrp2[]" value="4" /> <input class="single-count" type="checkbox" name="chkboxGrp2[]" value="5" /> <input class="single-count" type="checkbox" name="chkboxGrp2[]" value="6" /> <hr> <label>chkboxGrp3</label> <input class="single-count" type="checkbox" name="chkboxGrp3[]" value="7" /> <input class="single-count" type="checkbox" name="chkboxGrp3[]" value="8" /> <input class="single-count" type="checkbox" name="chkboxGrp3[]" value="9" /> </form> <div>Checkbox group total selected: <span id="chkboxGroupCount">0</span></div> <div>Selected: <span id="chkboxSelected"></span></div> </div> <script> var chkbox = document.getElementsByClassName('single-count'); for (var i = 0; i < chkbox.length; i++) { chkbox[i].addEventListener('click', chkboxGrpCount); } function chkboxGrpCount() { var inputNameArray = []; for (var i = 0; i < chkbox.length; i++) { var chkBoxNameStripSqrBraces = chkbox[i].name.replace('[]', ''); if (inputNameArray.indexOf(chkBoxNameStripSqrBraces) === -1 && chkbox[i].checked === true) { inputNameArray.push(chkBoxNameStripSqrBraces); } } document.getElementById('chkboxGroupCount').innerHTML = inputNameArray.length; document.getElementById('chkboxSelected').innerHTML = inputNameArray.toString(); } </script> </body> </html>
  2. dsonesuk

    = vs like

    If that is exactly what you use, then maybe you should try it without the semicolon within the SQL query
  3. dsonesuk

    few checkbox checked, but count as one

    I don't see how that would work with 3 different named groups of checkboxes? it sums up selected checkbox values of groups, not the number of groups selected.
  4. dsonesuk

    session_start(): cannot send session cache limiter

    Do you call the header() function, use php cookies, anywhere in your other scripts.
  5. dsonesuk

    session_start(): cannot send session cache limiter

    It is at the very top of document before the doctype and any html whatsoever, yes! Also none of the other included files do not include session_start() either, yes! And theres definitely no line break, space before <?php or space after. Any of these will cause already open header error.
  6. dsonesuk

    Links behind DIV don't work on iOS

    I can't do anything with this in its present state, old wrong Doctype!, old deprecated CSS and html, misplaced script tag, no unit value for CSS property, invalid CSS property definition. The doctype should be adjusted to represent current HTML5 document doctype ('<!doctype html>'), some of the new CSS you are attempting to use, will only work with HTML5, this also means you will have to use supported CSS and HTML as well.
  7. dsonesuk

    Block Size

    Considering block-size is experimental and only works for Firefox browsers, why even think of using it? Also you can't use div within table how you have shown, only outside the table or within a table td element, which also must be within a tr element to take the text 'example#'.
  8. dsonesuk

    hex to binary conversion understanding

    That is how numbers are formatted, leading 0s will always be removed, unless you convert to text string.
  9. dsonesuk

    JAVASCRIPT nodeList/nodeCollection

    Both work exactly the same if used correctly, with nodeValue you have to access the parent element text node first using childNode[0] then nodeValue (childNode[0].nodeValue), with .innerHTML its simple needs a reference to parent element in question to add or retrieve text within it.
  10. dsonesuk

    JAVASCRIPT nodeList/nodeCollection

    Yes! spaces are Text nodes, if you want to be element specific only, use '.children' instead function a(index) { var d = elements[index]; alert("Children length: " + d.children.length); alert(d.children[1].nodeName); alert("childNodes length " + d.childNodes.length); alert(d.childNodes[1].nodeName); }
  11. dsonesuk

    JAVASCRIPT nodeList/nodeCollection

    You can see this, using function a(index) { var d = elements[index].childNodes for (i = 0; i < d.length; i++) { alert(d[i].nodeName); } }
  12. dsonesuk

    JAVASCRIPT nodeList/nodeCollection

    The reason it does not give the result you expect, is because any line breaking or stacking of html is treated as a space, and these or any spaces present is treated as a text node
  13. dsonesuk

    Links behind DIV don't work on iOS

    Sounds like Voodoo magic! unless you have an element overlapping somehow. Maybe you should supply link so we can actually see this black magic effect at work.
  14. dsonesuk

    iframe custom scrollbar

    have you tried overflow-y: auto; overflow-x: hidden;
  15. dsonesuk

    setting page break

    Try these solutions https://stackoverflow.com/questions/1763639/how-to-deal-with-page-breaks-when-printing-a-large-html-table
  16. dsonesuk

    Map works but forEach is not working. Why?

    One creates a new array and insert each item from old to new and applies to a variable, the other loops through old array elements. It won't produce the same result unless it pushes the items into a new already created array. To produce duplicate array from both var myNames = ['apple', 'orange', 'lemon']; let output = myNames.map(function(item) { return item; }); console.log(output); let output2 = []; myNames.forEach(function(item2) { output2.push(item2); }); console.log(output2);
  17. dsonesuk

    Form validation help (regex and PHP)

    That is the status code for AJAX, you might be able to still use this as an unvalidated identifier, if not valid you have to on validating on email page, set up sessions to take present values and error messages for those empty inputs, then redirect using to header() back to the form page and read those sessions there.
  18. dsonesuk

    browser window not resizing for text per media queries

    You have missing value and units for some properties, and your media queries using max-width are wrong way round higher top followed by lower 1366 768 By adding different background-color: to html or body, you can identify which is triggered or not, and what and where it needs to be changed. Only by using min-width would the media queries current position be correct.
  19. ??? You use the username and password value they provided, hash the password value and identify if they both match with those stored in database
  20. dsonesuk

    Form validation help (regex and PHP)

    You just need to create a PHP script to validate, and return a specific message for the error that relates to an input if validation fails. Check if specific error is not blank, then you can add a specific class or styling attribute, as you already have for JavaScript to represent that there was an error. You can either validate on same php form page, until it passes validation then send to different page for further processing.
  21. dsonesuk

    Form validation help (regex and PHP)

    PHP validation is a must, JavaScript validation gives a quicker user friendly option without reloading of page that PHP would require. Once the passing of validation in JavaScript is done, the validation through PHP should be instant, as all validation requirements have already been done through JavaScript.
  22. dsonesuk

    Form validation help (regex and PHP)

    And don't reply with "its still not working" look at web developer tools, it should show a error why its not working, that's more helpful.
  23. dsonesuk

    Form validation help (regex and PHP)

    change if(regex1.test($prenom.val())=false) to if(regex1.test($prenom.val())==false)
  24. dsonesuk

    Form validation help (regex and PHP)

    You are applying css to the variable of $prenon which now is the value of $('#prenom').val(); try var $prenom = $('#prenom'); /*var $nom = $('#nom'); var $email = $('#courriel');*/ var regex1 = /[^\d\W]{2,20}[\-\s\']{0,1}/i; if(regex1.test($prenom.val())=false){ $prenom.css({"border-color":"red"}); alert("ERROR!"); return false; }else{
  25. dsonesuk

    Form validation help (regex and PHP)

    It's .val() NOT .value()