Jump to content

lwsimon

Moderators
  • Posts

    105
  • Joined

  • Last visited

About lwsimon

Profile Information

  • Location
    Harrison, AR

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

lwsimon's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. lwsimon

    Page from PHP to HTML

    If I understand your use case, I'd not try to generate an actual HTML page. Instead, I'd take submit the form back to the same page, but add a textarea with the code in it. That way, if they aren't happy with it, they can modify the original stuff, and resubmit to see their changes. Having it in a textarea also makes it easy for the user to copy the HTML to paste into their forum profile.
  2. Count me as a second vote for CodeIgniter. I'm writing a URL redirection service with statistics and user accounts now, and its taking me about 30 hours - not bad. Next up: A CMS.
  3. The best free PDF printer I know of is CutePDF.
  4. There is a F/OSS product out there - Scribus. I've not used it extensively, so I can't really vouch for it, but it is defiantely worth checking out before spending cash.
  5. I fixed that issue - here's my solution (maxlength stuff does not yet work in IE) function FormValidation (id){ /*************** * Constructor * ***************/ //id is an optional variable. if (id === undefined) id = 'standardForm'; //handle excess inputs with limited length $('form#' + id + ' input[maxlength]').each(function(){ $(this).attr('max_chars', $(this).attr('maxlength')).removeAttr('maxlength').keyup(function(){ if ($(this).val().length > $(this).attr('max_chars')) { $(this).addClass('invalid'); } else { $(this).removeClass('invalid'); } }); }); //run .validate() when form submits var self = this; $('form#' + id).submit( function(event) { event.preventDefault(); self.validate() return false; }); this.applyTo = function(formID) { alert('formID'); } /************** * Properties * **************/ this.inputMasks = { 'notempty': /./, 'alpha': /^[a-z]+$/i, 'numeric': /^[0-9]+$/, 'alphanumeric': /^[0-9a-z]+$/ }; this.maskedFields = []; /*********** * Methods * ***********/ this.addMask = function(id, mask, message) { //verify inputs if( id === undefined ) return; if( mask === undefined ) mask = 'notempty'; if( message === undefined ) message = null; //append to stack this.maskedFields.push( { 'id': id, 'mask': mask, 'message': message } ); } this.validate = function() { var error = 'Errors were encountered. Please verify all input is valid.'; var failedValidation = false; for( i = 0 ; i < this.maskedFields.length ; i++ ){ var value, regex; value = $( 'input#' + this.maskedFields[i]['id'] ).val(); regex = this.inputMasks[ this.maskedFields[i]['mask'] ]; var failedMask = !regex.test(value); if( failedMask ){ var message = this.maskedFields[i]['message']; failedValidation = true; if( message !== null ) error = error + "\n -- " + message; } } if( failedValidation === true ){ alert(error); return false; } alert('passed validation'); return false; } }
  6. In the highlighted line below, 'this' refers to the form object, not the FormValidation Object. How can I bind a method of the FormValidation object to the submit event on the form? function FormValidation(id){ /*************** * Constructor * ***************/ //id is an optional variable. if (id === undefined) id = 'standardForm'; //handle excess inputs with limited length $('form#' + id + ' input[maxlength]').each(function(){ $(this).attr('max_chars', $(this).attr('maxlength')).removeAttr('maxlength').keyup(function(){ if ($(this).val().length > $(this).attr('max_chars')) { $(this).addClass('invalid'); } else { $(this).removeClass('invalid'); } }); }); //run .validate() when form submits $('form#' + id).bind('submit', function(event){ event.preventDefault(); this.validate(); /////////////// <-------------------------This line isn't working. }); /************** * Properties * **************/ this.inputMasks = { 'notempty': /./, 'alpha': /^[a-z]*$/i, 'numeric': /^[0-9]*$/, 'alphanumeric': /^[0-9a-z]*$/ }; this.maskedFields = []; /*********** * Methods * ***********/ this.addMask = function(id, mask, message) { //verify inputs if( id === undefined ) return; if( mask === undefined ) mask = 'notempty'; if( message === undefined ) message = null; //append to stack this.maskedFields.push( { 'id': id, 'mask': mask, 'message': message } ); } this.validate = function() { var error = 'Errors were encountered. Please verify all input is valid.'; var failedValidation = false; for( i = 0 ; i < this.maskedFields.length ; i++ ){ var value, regex; value = $( 'input#' + this.maskedFields[i]['id'] ).val(); regex = this.inputMasks[ this.maskedFields[i]['mask'] ]; var failedMask = !regex.test(value); if( failedMask ){ var message = this.maskedFields[i]['message']; failedValidation = true; if( message !== null ) error = error + "\n" + message; } } if( failedValidation === true ){ alert(error); console.log("Validation failed"); return false; } console.log('Validation passed'); return false; } }
  7. I would not use this technique. What happens when someone has javascript turned off? They see your form, fill it out, hit reply, and get an insulting message. Then, you never email them back. Nice.
  8. I believe that is a variable variable. As in, $spec contains the name of the property you're trying to access on class that snippet is a member of.
  9. I now host all my client emails, plus my own, with Google. You get the functionality of Gmail, with an @domain.com email address. You can also sign up for Google docs, calendar, and a myriad of other services I've not messed with yet. It is dead easy to set up, too. The only reason I would consider going with someone else is if the client required a SLA. Check out google.com/apps (Sorry for the spam-like reply, but it *is* a solution to the problem, and I have no interest in Google)
  10. What browser are you using to test in? If you're using IE, I would strongly suggest that you download Firefox, and use Firebug for Javascript debugging. Its error messages are much, much better than IE's. This would not have shown up though. A debugger can only tell you when you've made a syntax error. This is a logic error - you're writing to a document that is already rendered. Do you have past experience programming? If not, I would actually suggest learning PHP before learning Javascript. PHP is more "traditional" and has better documentation. A lot of people, including people who write tutorials, write very poor javascript.
  11. document.write() is deprecated and is poor form. It works by immediately inserting text into the document while it is still being rendered by the browser - in this case, you're calling it after the document is loaded, so it ha nowhere to write to. Try this: function mouseOver() { alert("hello!!"); } function mouseOut() { alert("goodbye!!!"); } That should give you a popup when you go in and out of the area.
  12. Buy it with a Visa or Mastercard? Reverse the charges. :cool: If it didn't work as advertised, it didn't work.
  13. From an ethical perspective, I think its fine - especially if you often use templates for client work.
  14. It would be better to assign a class instead: $("li.myLi").focus(function () { $(this).addClass('focus'); }); $("li.myLi").blur(function () { $(this).removeClass('focus'); }); Then do the styling in the CSS: :focus, .focus { color:red; }
  15. lwsimon

    Twitter

    Odd, but that last one makes the most sense - doesn't it mean that the pilot was in control of the aircraft when it impacted, but was either disoriented, or couldn't see where we was going?
×
×
  • Create New...