We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7872
    • 14 Posts
    Hi, all.

    I need help.

    I use search form and want to use onFocus=’if(this.value=="Логин")this.value="";’ onBlur=’if(this.value=="")this.value="Логин";’ for input as:

    <?php
    if($_GET["id"]!=6){
    echo ’
    <form name="ValidCheck" method="POST" action="./index.php?id=79" id="FormSearchCheck">
    <table><tr><td><input class="BlockSearchInput" type="text" name="NubbChk" id="NumChkInput" value="Введіть номер серії" id="firstname" name="firstname" tooltipText="В це поле потрібно вписати номер серії, який Ви знайдете на упаковці." onFocus=’if(this.value=="Логин")this.value="";’ onBlur=’if(this.value=="")this.value="Логин";’ /></td><td><input type="image" src="[(site_url)]/assets/templates/medpotreb.org/images/button_search.png" name="ChkForm" id="ChkForm"></td></tr></table>
    <form>

    ’;
    }
    ?>

    but

    Parse error: syntax error, unexpected T_STRING, expecting ’,’ or ’;’ in /var/www/medpotreb/medpotreb.org/manager/includes/document.parser.class.inc.php(770) : eval()’d code on line 4

      • 10152
      • 156 Posts
      Hi, try to escape the ’ before onBlur.
      Like this : \’

      just add \ before ’
        • 7872
        • 14 Posts
        It’s don’t work. Search is work with this code, but do not work "onFocus".
          • 10152
          • 156 Posts
          try this :
          <?php
          if($_GET["id"]!=6){
           echo '
               <form name="ValidCheck" method="POST" action="./index.php?id=79" id="FormSearchCheck">
                 <table><tr><td><input class="BlockSearchInput" type="text" name="NubbChk" id="NumChkInput" value="Введіть номер серії" id="firstname" name="firstname" tooltipText="В це поле потрібно вписати номер серії, який Ви знайдете на упаковці." onFocus=\'if(this.value=="Логин")this.value="";\' onBlur=\'if(this.value=="")this.value="Логин";\' /></td><td><input type="image" src="[(site_url)]/assets/templates/medpotreb.org/images/button_search.png" name="ChkForm" id="ChkForm"></td></tr></table>
              <form>
          
          ';
          }
          ?>
          
            • 3749
            • 24,544 Posts
            It might be easier to just use " on the outside and escape all the quotes (both kinds) inside.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 7872
              • 14 Posts
              Sorry, guys. Don’t work.
                • 3749
                • 24,544 Posts
                What code do you see when you do "view source" ?

                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting