views:

341

answers:

6

Hi, further to a previous question, I have this code:

   <p class="required">
  {err for="msg"}
   <!--{{label {t _inquiry_msg}:}}-->
   {textarea onblur="if(this.value=='') this.value='Skriv her';" onfocus="if(this.value=='Skriv her') this.value='';"}

  {/err}
 </p>

And I want the output to be

<textarea onblur="if(this.value=='') this.value='Skriv her';" onfocus="if(this.value=='Skriv her') this.value='';">Write here!</textarea>

I tried {/textarea} but it didn't work in my template file.

Also, using html <> tags doesn't work, it breaks the page.

http://euroworker.no/Konftel-300-IP.268

Is it possible to make this in smarty/php?

Thanks :)

+1  A: 

Just put:

<textarea onblur="if(this.value=='') this.value='Skriv her';" 
          onfocus="if(this.value=='Skriv her') this.value='';">Write here!</textarea>

Smarty will not replace anything.

Luis Melgratti
This does not work, I already tried to use HTML tags, but it breaks the page.
Kyle Sevenoaks
if that breaks the page your problem has NOTHING to do with smarty.
Erik
A: 

You missed something here:

<!--{{label {t _inquiry_msg}:}}-->

I don't know what this code should do but the error is definitely here

<!--{{label} {t _inquiry_msg}:}}-->

then the HTML should work fine

<textarea onblur="if(this.value=='') this.value='Skriv her';" onfocus="if(this.value=='Skriv her') this.value='';">Write here!</textarea>
diego2k
Good spot! but it still didn't work.
Kyle Sevenoaks
Try remove the comment ( <!-- ) and leave only the <textarea>
diego2k
Nope, that didn't work either.. I really am stumped.
Kyle Sevenoaks
A: 

Please try the following steps, and keep commenting:-

  1. Please try to remove the whole commented line, between the "{err for="msg"}" line & the "{textarea}" line.
  2. Now remove the curly braces from the "textarea" line of code, and write plain HTML, just like "Luis Melgratti" posted in his answer.
  3. If possible, try to upload some screenshot images of the error, which the page is showing.
Knowledge Craving
+1  A: 

You really ought to start with the W3C markup validator and than try to find your bug.

dare2be
A: 

Smarty 3 or Smarty 2? Because in version 3 the tag filtering {...} has been way improved.

Wernight
I am not sure, how can I find out?
Kyle Sevenoaks
If you don't know which you've downloaded, check either Smarty.php or README.txt provided with your Smarty. You should find the version number somewhere inside.The folder structure changed a lot. You could simply compare the main folders inside the "lib" directory and compare with verison 2 and version 3.
Wernight
It's version 2.6.13. but you see I was bought in to edit some layout features of a Smarty website, so I have NO idea what or who has done what or where things are.. I'm VERY new to Smarty.
Kyle Sevenoaks
Try upgrading to Smarty3. As I said, its grammar analyser (the way it detects Smarty tags) has been improved a lot, plus other things.
Wernight
+1  A: 

Write directly:

<textarea onblur="if(this.value=='') this.value='Skriv her';" 
          onfocus="if(this.value=='Skriv her') this.value='';">Write here!</textarea>

If it does not work, it has nothing to do with smarty.

Cristian