473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Smarty won't display strings with double quotes in input fields

dlite922
1,584 Expert 1GB
Hey guys, this is so weird, i don't know what else to do. Hopefully one of you is a Smarty guru as this is difficult to search (google and smarty forum) and if you aren't i'll post answer here, i'm sure one of you will run into it.

I have an array of object, one of those objects has an attribute that is a string (description), This description does not appear in an INPUT text field ONLY, but appears to print inside div tags just fine.

Just before the display, i did a die print, here's that output:

Expand|Select|Wrap|Line Numbers
  1. Array
  2. (
  3.     [0] => ViolationVO Object
  4.         (
  5.             [id] => 299
  6.             [caseID] => -1
  7.             [citationID] => -1
  8.             [noteID] => -1
  9.             [amendedFromID] => -1
  10.             [amendedToID] => -1
  11.             [dispositionCode] => 
  12.             [commonCode] => 
  13.             [violationCode] => 004
  14.             [description] => "THIS IS A TEST NUMBER 2"
  15.             [points] => 4
  16.             [amount] => 200.00
  17.             [lastUpdate] => 
  18.             [byUser] => 
  19.         )
  20. )
  21.  
  22.  
There's only one object in this array, but it doesn't matter, if i have 10 all the ones with double quotes in the description fail to appear. ONLY the description field does not display, all other attributes do.

Here's my smarty (html) display.

[PHP]{foreach from=$caseEditPage->getViolationVOList() item=violationVO}
<tr>
<td><input type="hidden" name="violationID[]" id="vID{$count}" value="{$violationVO->getID()}" />
<input type="text" class="field4" name="violationCode[]" id="vCode{$count}" value="{$violationVO->getViolationCode()}" onblur="organizeViolationTable();getDescriptionAnd Point(this, {$count});" /></td>
<td><input type="text" class="field6" name="violationDescription[]" id="vDesc{$count}" value="{$violationVO->getDescription()}" /></td>
<td><input type="text" class="field3 alignRight" name="violationPoints[]" id="vPoints{$count}" value="{$violationVO->getPoints()}" /></td>
<td><input type="text" class="field3 alignRight" name="violationAmount[]" id="vAmount{$count++}" value="$ {$violationVO->getAmount()|number_format}" onblur="convertToCurrency(this.id)" /></td>
</tr>
{/foreach}



[/PHP]

The problem is on the 5th line.

This same foreach is done else where on the page, but not in to a text box and it appears fine.
Mar 24 '08 #1
2 4467
dlite922
1,584 Expert 1GB
SOLVED:

It's kind of stupid but hey, what are you gonna do:



Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. {$variableWithQ|escape}
  4.  
  5.  
don't understand why it won't just display it (or nothing comes to my mind at this moment, so i'll continue to call it stupid)

Peace,


DM
Mar 24 '08 #2
satas
82
It is not stupud. Consider following examples:
[PHP]<?php
$ttt = "\"some text\"";
?>
<input type="text" value="<?php print $ttt;?>" />[/PHP]
We can see nothing in the input field in the browser (but not in the source).
And this:

[PHP]<?php
$ttt = "\"some text\"";
?>
<input type="text" value="<?php print htmlspecialchars($ttt);?>" />[/PHP]
All goes fine.
Mar 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Richard | last post by:
I need help. I have a smarty based program that I am modifying. I have a smarty template file that consists of smarty and HTML. I need to integrate some PHP database calls into it. My problem...
2
by: Mike | last post by:
I am sure that I am making a simple boneheaded mistake and I would appreciate your help in spotting in. I have just installed apache_2.0.53-win32-x86-no_ssl.exe php-5.0.3-Win32.zip...
3
by: Unregistered | last post by:
Hi there, i got this javascript-function that changes the entries of a selectbo depending from the selection of another selectbox: function changeBezug(selectedEntry, '$exhibits', .....) {} ...
5
by: Gregg | last post by:
Hello all, I have been banging my head over a problem that I am having reading a comma seperated file (CSV) that can contain from 1 to 10,000 records. My code snipit is as follows: **Start...
19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
2
by: J Huntley Palmer | last post by:
Whenever I put in a smarty variable in a link definition as : <a href="{$foo->bar}">foo</a>, it shows up as a literal as above in the link and not the contents of the variable itself....
0
by: ev45ive | last post by:
Hi! I have smth. like this: file.php: <?php SmartyValidate::connect($smarty); //SmartyValidate::register_form('register');
2
by: Marco Trapanese | last post by:
Hello, I have to define a structure for a plain-text input file. It should have some general text fields and a long table of values. These values are grouped by rows and can be integers, floats,...
17
by: john | last post by:
All: I'm a long-time developer, new to PHP.... Is there an idiom used in PHP to construct SQL statments from $_POST data? I would guess that in many applications, the data read from $_POST...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.