Jump to content

maxxd

Gurus
  • Content Count

    988
  • Joined

  • Last visited

  • Days Won

    24

Everything posted by maxxd

  1. Again, are you setting the value of #birthday to the computed date before you submit the page? If not, the processing script will have 'birthday' in $_POST['birthday'] because your validation script doesn't change the value of the field.
  2. I'd give http://api.jqueryui.com/datepicker/#method-getDate a shot - it should at least put you on the right track for this. http://api.jqueryui.com/datepicker/#option-yearRange You're already running a complete page refresh on form submit, so I don't really see where this would become an issue for you. And again, you could format the date string in PHP before it's output to the page, thereby negating what appears to be a pain point for you.
  3. Legit. However, you can use jQuery's datepicker with drop-down month and year selectors to make this easier. To the question at hand, you say you're getting the date from a drop-down menu. How is that built? Seems to me it'd be easiest to add the leading zero on the value attribute (not necessarily the display text) during form compile rather than during validation and/or submission. As to your question about the validation, it depends on how you're submitting the data to the controller script. If you're submitting via AJAX from JavaScript, make sure you're passing the 'birthday' variable you've built in that snippet. If you're doing a full page refresh, assign the value of the 'birthday' variable to the hidden input before submitting the form - otherwise whatever script is processing the form data is getting the data from the hidden form field and not the JS variable.
  4. Is there a reason you're not using a datepicker? I know the jQuery DatePicker has formatting options and I have to assume other native/node/ESx datepickers do as well. It'd certainly be easier than prepending zeros to combobox values everywhere.
  5. I'm pretty sure - though I could be wrong - that rem and em take browser zoom into account, so if I'm right that could be another thing to look at. Although requinix is correct - the entire point is to make the font bigger. It can be pretty safely assumed that people that use the zoom functionality know they're messing with the designer/developer intent of a site and are OK with it. Kinda like turning off JavaScript in your browser - you do it and you pretty much forfeit the right to complain about site functionality (now days, anyway).
  6. You would simply pass the database query results (or portions thereof) to the function that outputs (or collates the data for) your form. It certainly doesn't need to be a global variable, unless I'm misunderstanding what you're asking. Post the code you're working with and we'll all have a better idea of what's going on.
  7. Add $mail->SMTPDebug = 2; before you try to send the mail. It'll give you a lot more detail as to the error that's happening.
  8. .innerHeight() is working in tests here, unless I'm misunderstanding what it is you're wanting.
  9. First and foremost, you've got some serious syntax issues, especially this line: list += '<li">'+this.id+' '+this.name</li>'; You see where your nested quotes are all over the place and you're missing the concatenation before the closing <li> tag? You'll need to correct that to begin with. Moving on from that, I'm not quite sure what you're trying to do. It sounds like you've got a list and want to select individual elements of that list using back and forward buttons? If I'm correct in that assumption, you'll want to build the list before you call your click() function. Personally, I'd build the list with 'data-index' and 'data-selected' attributes on each list item element. That way, when you click the next or previous button you can grab the data-index value of the data-selected="true" list item element, add or subtract one from it, target the list item element that has a matching data-index value and set it's data-selected attribute to "true". You'd obviously have to set the previous list item element's data-selected attribute to "false" at the same time. That way you really don't have to worry about keeping an index in the JavaScript.
  10. Right. You assign the return value of the function to a variable. A more explicit version of ginerjm's example: $connection = is_connected(); echo $connection; See the difference in what you typed and your second block of code in your first post?
  11. You're not assigning the returned value from is_connected() to $connection. You're just calling the function and expecting that $connection has been created elsewhere.
  12. He's talking about using this or this, and checking the documentation about how to do so. Yes, you should be able to set up SMTP via Gmail on both. I've not used Yahoo or Swift, to be honest, but I use PHPMailer on a regular basis and can tell you it's simple and it works much better than PHP's native mail() function.
  13. maxxd

    Regex huh?

    As someone who's really bad with RegEx, I've found this site very helpful while trying to figure out a pattern. Thanks to that, I've actually gotten my last couple regex's to work without having to bother people by posting it here.
  14. Post your code here - not everyone trusts external links. In the meantime, looking at the code you've already posted, where does $filename come from?
  15. There probably won't be any errors in your console - everything's working fine on the client side. Check the Network tab - look for the ajax call to 'file.php', then see what the return is.
  16. According to the documentation, the success function will only run when the call succeeds - you need to check for errors using the error function. What does the network tab of your developer tools have to say?
  17. Don't feel bad, I've been doing this for 20 years pretty much straight through and I'm still playing catch-up. I've had some people scoff recently because I use Vagrant and Gulp and manually deploy WordPress sites to a server as opposed to Docker, Webpack, continuous integration, and automated deployment to a server-less AWS instance. What I'm saying is that this stuff moves hella fast.
  18. An auto-prefixer will add any necessary browser-specific prefixes to CSS rules during compile time. I use gulp-autoprefixer in my build flow right after I convert from .less to .css and concat all the files, but before I minify. My CSS task in my gulpfile looks like this: const aw = require('gulp-load-plugins')({ pattern: ['*'], scope: ['dependencies'] }); // .... other tasks aw.gulp.task('compileCSS', () => { "use strict"; return aw.gulp .src(theme.srcStyle) .pipe(aw.plumber(handleError)) .pipe(aw.less({ strictMath : 'on', strictUnits : 'on', })) .pipe(aw.concat('all.css')) .pipe(aw.autoprefixer({ browsers: [ "last 2 versions", "IE >= 10", ], grid: false, })) .pipe(aw.cssmin()) .pipe(aw.rename({ extname : '.css', basename : 'style' })) .pipe(aw.gulp.dest(theme.destCSS)); }); Note the `aw.autoprefixer` call - that's using the gulp-autoprefixer module and asking it to add any browser-specific prefixes necessary for all browsers up to 2 versions back from the current version of all modern browsers, as well as Internet Explorer 10 and 11. It also turns grid CSS support off because the support for grid in media queries is a bit spotty. At any rate, it allows me to type this: .wrapper{ display: flex; flex-direction: row; justify-content: space-between; align-items: flex-end; } And get this output: .wrapper{display:flex;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end} You can see how the flex-direction and justify-content browser-specific syntax for both IE10 and Safari 3.0 on iOS 1.0 are appended automatically. Obviously you'll get more rules as you change the values in the browsers array you pass into the autoprefixer call in your gulpfile. tl;dr - it saves you a lot of time thinking, Googling, and typing while doing it's best behind the scenes to make sure your site's CSS is consistent across as many browsers as possible. Totally random aside, but I'll probably start trying to use sourcemaps soon, which right now I don't due to the in-house development style at my job, because I'm currently trying to change that process.
  19. I'm not terribly versed in Bootstrap, but I can tell you that w3schools should be used as - at best - a place to find the terms you need to Google for the actual information. From what I can see from the documentation, Bootstrap's flexbox coverage looks pretty good, though it's always been the small, medium, large, and extra large designations that my brain doesn't deal well with. *edit* I'm not sure what kind of auto-prefixing Bootstrap does - I have to assume there's some as it's so widely used, but that may be a bit of a sticking point, especially with the mobile Samsung browser as it seems to have some idiosyncrasies of its own. Also, watch iOS Safari with flexbox as that can be a bit sticky if you're not using Babelify or another auto-prefixer (and sometimes even if you are - I've found it to do some strange things for no reliably reproduce-able reasons).
  20. Building on your other post, what are your target browsers? If you're not concerned with IE9 and are using an auto-prefixer (or don't mind typing a lot) you can use flexbox. A combination of flex-grow with justify-content and align-items can do exactly what you're looking for easily. If you're targeting more modern browsers (in other words, you don't mind skipping out on IE support entirely), you can use grid, though that could be more complicated depending on how your brain works. If you are dealing with much older browsers, use 100vh with positioning and transforms as @Barand suggests.
  21. Yeah, I also love me some Microsoft for most things. IE, however, still sucks in a major way. Edge is slightly better in my experience, but I'm still about Firefox and Chrome on Windows 10.
  22. Nothing at all wrong with using Modernizr. However, IE9 has (according to the Can I Use browser report) a 0.17% usage through 2018. navigator.cookieEnabled (please note it's cookieEnabled, not cookiesEnabled()) has full browser support according to MDN, even in IE - admittedly, no browser version is noted - and doesn't require an additional header call and/or download. Now, Modernizr's download footprint is small and well done, so it probably not that big a consideration in the long run. Either way, it's up to you and you gotta go with what you're comfortable with.
  23. Ooof. You're still supporting IE9? Government contract or sadistic manager? All kidding aside... ooof. We just recently dropped support for 10, but even that's a massive step up from 9.
  24. Instead of reinventing the wheel, use navigator.cookieEnabled. It looks like it's available across all browsers, and it's a lot less typing. If it returns false, pop up a modal telling the user they need to enable cookies. If it returns true, do whatever you need with cookies.
  25. What kind of data are you expecting to work with? PHP can work with image, text, JSON, XML, PDF, and many other types of data but it's all done differently. So, what are you actually trying to accomplish other than altering user-supplied data?
×
×
  • 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.