We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16544
    • 86 Posts
    Hi guys! Easy Newsletter has three inputs, First name, Last name and email and I want them to be onfocus, e.g. first name will be in the input area and when you click it, it goes away. Now I have:
    <input type="text" name="firstname" size="50" maxlength="50">

    I tried to put this:
    <input type="text" name="firstname" size="40" maxlength="40" value="firstname" onblur="if(this.value == '') {this.value='firstname'}" onfocus="if (this.value == 'firstname') {this.value=''}" />

    but it’s not working, I’m getting an error.
    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in ..../manager/includes/document.parser.class.inc.php(770) : eval()’d code on line 93
    What am I doing wrong? undecided Thanks
      I had fainted, unless I had believed to see the goodness of the LORD in the land of the living.
      • 26016
      • 561 Posts
      Hmmm... interesting. The code actually looks good to me.
      First thing I would try would be to add the semi-colons to the Javascript statemement as per below.

      <input type="text" name="firstname" size="40" maxlength="40" value="firstname" onblur="if(this.value == '') {this.value='firstname'};" onfocus="if (this.value == 'firstname') {this.value=''};" />


      Then again, maybe all that code will bork the parser anyway.

      Good luck, D
        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4