R2i DotNetNuke® Forum

R2i wants you to have the opportunity to ask questions, post reviews, help others or just rant and rave about DotNetNuke® or any of the R2i Modules and Skins. Our team spends hour upon hour, day after day, working on custom DotNetNuke® modules and services; please feel free to ask us anything.
 
Commas and other characters in text input cause problems...
Last Post 01 Jan 1900 05:00 AM by . 31 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Page 1 of 212 > >>
Author Messages Informative
rickwpUser is Offline
New Member
New Member
Posts:92

--
28 Feb 2008 05:07 AM  
I'm still having some problems with special characters and not-so-special characters in data entry forms. To populate the data entry form for editing a record, I am using [$txtAddress1:Form,{ISEMPTY:[Address1]}]. If the field contains any special characters, including a comma, the form field is empty when the edit is brought up. If I save the record without making any edits, the proper former data is saved properly, so no data is lost, it's just the form field deceivingly appears empty of data. Using a period doesn't seem to effect anything. I'm assuming it's because the comma is causing problems within the [$format...] tag used as the "value" of the input box. Should I be setting up data entry forms with a different way of prepopulating the form with a records existing data? Again, this is not a problem with textarea input, just text box input. Anyway, should I be doing this differently? This is the full tag as is in the format listing:

<td class=NormalTextBox nowrap align="left" width="100%"><input type=textbox class=Tier3TextBox id=txtAddress1 name=txtAddress1 value="[$txtAddress1:Form,{ISEMPTY:[Address1]}]" MaxLength=100 size="100%" /></td>

I have sql injection protection checked, and have tried this with and without the escape html checked on, and have left listx escaping turned off. Would single or double escaping listx help in the variable setup?

Rick


pauldesUser is Offline
Veteran Member
Veteran Member
Posts:1392

--
28 Feb 2008 11:56 AM  
what does the HTML look like if you view the source? is it really not there or is it a rendering issue?


ListX....makes you look brilliant, even though you're not.
pauldesUser is Offline
Veteran Member
Veteran Member
Posts:1392

--
28 Feb 2008 12:03 PM  
Also, have you tried any other formatters? like [COALESCE,txtAddress1,Form,Address1,]


ListX....makes you look brilliant, even though you're not.
pauldesUser is Offline
Veteran Member
Veteran Member
Posts:1392

--
28 Feb 2008 12:03 PM  
Also, have you tried any other formatters? like [COALESCE,txtAddress1,Form,Address1,]


ListX....makes you look brilliant, even though you're not.
rickwpUser is Offline
New Member
New Member
Posts:92

--
29 Feb 2008 12:31 AM  
I have Ajax enabled, so no html in view source. Even though the field showed up as being blank, the data is there because saving it resaved the very data that is not shown in its blank field. I didn't try coalesce, I'm assuming that the commas in the text value of the field would also cause problems with any other tags, too.

I also had problems with another field where I used a format tag to truncate the length of the text: [format,[fieldname],{left:150}]. When the text value of the field contains a [ ] pair in the text, the closing ] in the text closes the format tag and wreaks havoc on the listing display for the rest of the fields in that row.

So, I seem to be having this problem with pretty much any tag or scenario where the data from the database contains commas or [ ] etc. And I've tried setting variables to escape listx tags and escape html, but can't seem to find the right combination to display the content of the field without having the content of the field interact with the listx tags being applied to the field. I'm assuming that some type of escaping on the characters in the field would be the answer, or some type of escaping within the tags themselves, or some combo of escaping in the variable settings, or some combo of the above. I can't imagine that no one else ever stores data into fields without ever using a comma in that fields text. I could see where [ ] would rarely be used, but we are providing reference material mainly to libraries and librarians who would most likely view improper syntax as being unprofessional, especially when a lot of our data is supplied as quoted data from other sources where the source is using [] and () and commas and proper grammatical syntax. Some things are very unimportant to us while things like this are more than important, they are required to maintain our professional image.

Thanks for the suggestions,

Rick


TalalUser is Offline
New Member
New Member
Posts:90

--
02 May 2008 06:19 AM  
Rick, have you found a solution to this?
I am having the very same problem.

I have not tested this in the beta OWS. But i have a live application for a customer and this is starting to be a SHOW STOPPER.

Anyone from the support team can help?


rickwpUser is Offline
New Member
New Member
Posts:92

--
02 May 2008 08:43 AM  
No, I never found a real solution. This was less of a problem when using text areas instead of text boxes, that is for display and data entry, which creates those ugly side scroll bars on literally everything... Various formats and coalesces didn't seem to do anything at all, but the textarea solution has not caused any problems for us yet.

I have not been a beta tester so I can't say if it is resolved in OWS or not.

Rick


rickwpUser is Offline
New Member
New Member
Posts:92

--
02 May 2008 08:46 AM  
Actually, we didn't display the fields as text areas for data listings, just displayed normally without formatting. The text area is just on data entry and edit forms. -Rick


TalalUser is Offline
New Member
New Member
Posts:90

--
02 May 2008 09:19 AM  
try this... seems to work now for me.:
say you have a field called CustomerComments and the form's field is txtCustomerComments

Dont forget to use [$CustomerComments,{ENCODEHTML}] in the form.
for example <input type="text" name="txtCustomerComments" value="[$CustomerComments,{ENCODEHTML}]">

in the variables:
Type: FORM
Source: txtCustomerComments
Target: @CustomerComments
Left:' (a single quote)
Right:' (a single quote)
Empty:'' (2 single quotes)

Escape Single Quotes = yes
Escape HTML = Yes
and Escape ListX Once


Up to this point the text will be saved in the DB with HTML chars such as < etc.

But in my situation the customer does not want that. (internal data).

So i had to use a User Defined Function in TSQL that Decodes HTML. ( I will attach below)..

Now in the ACTION that saves:
Update tblCustomers Set CustomerComments = HTMLDecode(@CustomerComments) where ID=123

IMPORTANT: i am using SQL 2005.. this function will NOT work for SQL 2000 or prev. It will only work with 2005. You can however right yuor own that is similar.

Basically the only reason it will not work with anything before MS-SQL 2005 is that the varchar(MAX)/nvarchar(max) were only introduced in SQL 2005... you may already know that you can not use database 'text' fields as variables but that is completely different topic.

Here is the Function




SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[HTMLDecode] (@InputString NVARCHAR(max))
RETURNS NVARCHAR(max) AS
BEGIN
DECLARE @vcResult NVARCHAR(max)
DECLARE @vcCrLf NVARCHAR(2)
DECLARE @siPos SMALLINT
DECLARE @vcEncoded NVARCHAR(7)
DECLARE @siChar SMALLINT

SET @vcCrLF = CHAR(13) + CHAR(10)

SELECT @vcResult = @InputString
SELECT @siPos = PATINDEX('%&#___;%', @vcResult)
WHILE (@siPos > 0)
BEGIN
SELECT @vcEncoded = SUBSTRING(@vcResult, @siPos, 6)
SELECT @siChar = CAST(SUBSTRING(@vcEncoded, 3, 3) AS SMALLINT)
SELECT @vcResult = REPLACE(@vcResult, @vcEncoded, NCHAR(@siChar))
SELECT @siPos = PATINDEX('%&#___;%', @vcResult)
END

SELECT @siPos = PATINDEX('%&#____;%', @vcResult)
WHILE (@siPos > 0)
BEGIN
SELECT @vcEncoded = SUBSTRING(@vcResult, @siPos, 7)
SELECT @siChar = CAST(SUBSTRING(@vcEncoded, 3, 4) AS SMALLINT)
SELECT @vcResult = REPLACE(@vcResult, @vcEncoded, NCHAR(@siChar))
SELECT @siPos = PATINDEX('%&#____;%', @vcResult)
END
SELECT @vcResult = REPLACE(@vcResult, '&', NCHAR(0x0026))

SELECT @vcResult = REPLACE(@vcResult, '"', NCHAR(0x0022))
SELECT @vcResult = REPLACE(@vcResult, '<', NCHAR(0x003c))
SELECT @vcResult = REPLACE(@vcResult, '>', NCHAR(0x003e))
SELECT @vcResult = REPLACE(@vcResult, ' ', NCHAR(0x00a0))
SELECT @vcResult = REPLACE(@vcResult, '¡', NCHAR(0x00a1))
SELECT @vcResult = REPLACE(@vcResult, '¢', NCHAR(0x00a2))
SELECT @vcResult = REPLACE(@vcResult, '£', NCHAR(0x00a3))
SELECT @vcResult = REPLACE(@vcResult, '¤', NCHAR(0x00a4))
SELECT @vcResult = REPLACE(@vcResult, '¥', NCHAR(0x00a5))
SELECT @vcResult = REPLACE(@vcResult, '¦', NCHAR(0x00a6))
SELECT @vcResult = REPLACE(@vcResult, '§', NCHAR(0x00a7))
SELECT @vcResult = REPLACE(@vcResult, '¨', NCHAR(0x00a8))
SELECT @vcResult = REPLACE(@vcResult, '©', NCHAR(0x00a9))
SELECT @vcResult = REPLACE(@vcResult, 'ª', NCHAR(0x00aa))
SELECT @vcResult = REPLACE(@vcResult, '«', NCHAR(0x00ab))
SELECT @vcResult = REPLACE(@vcResult, '¬', NCHAR(0x00ac))
SELECT @vcResult = REPLACE(@vcResult, '­', NCHAR(0x00ad))
SELECT @vcResult = REPLACE(@vcResult, '®', NCHAR(0x00ae))
SELECT @vcResult = REPLACE(@vcResult, '¯', NCHAR(0x00af))
SELECT @vcResult = REPLACE(@vcResult, '°', NCHAR(0x00b0))
SELECT @vcResult = REPLACE(@vcResult, '±', NCHAR(0x00b1))
SELECT @vcResult = REPLACE(@vcResult, '²', NCHAR(0x00b2))
SELECT @vcResult = REPLACE(@vcResult, '³', NCHAR(0x00b3))
SELECT @vcResult = REPLACE(@vcResult, '´', NCHAR(0x00b4))
SELECT @vcResult = REPLACE(@vcResult, 'µ', NCHAR(0x00b5))
SELECT @vcResult = REPLACE(@vcResult, '¶', NCHAR(0x00b6))
SELECT @vcResult = REPLACE(@vcResult, '·', NCHAR(0x00b7))
SELECT @vcResult = REPLACE(@vcResult, '¸', NCHAR(0x00b8))
SELECT @vcResult = REPLACE(@vcResult, '¹', NCHAR(0x00b9))
SELECT @vcResult = REPLACE(@vcResult, 'º', NCHAR(0x00ba))
SELECT @vcResult = REPLACE(@vcResult, '»', NCHAR(0x00bb))
SELECT @vcResult = REPLACE(@vcResult, '¼', NCHAR(0x00bc))
SELECT @vcResult = REPLACE(@vcResult, '½', NCHAR(0x00bd))
SELECT @vcResult = REPLACE(@vcResult, '¾', NCHAR(0x00be))
SELECT @vcResult = REPLACE(@vcResult, '¿', NCHAR(0x00bf))
SELECT @vcResult = REPLACE(@vcResult, 'À', NCHAR(0x00c0))
SELECT @vcResult = REPLACE(@vcResult, 'Á', NCHAR(0x00c1))
SELECT @vcResult = REPLACE(@vcResult, 'Â', NCHAR(0x00c2))
SELECT @vcResult = REPLACE(@vcResult, 'Ã', NCHAR(0x00c3))
SELECT @vcResult = REPLACE(@vcResult, 'Ä', NCHAR(0x00c4))
SELECT @vcResult = REPLACE(@vcResult, 'Å', NCHAR(0x00c5))
SELECT @vcResult = REPLACE(@vcResult, 'Æ', NCHAR(0x00c6))
SELECT @vcResult = REPLACE(@vcResult, 'Ç', NCHAR(0x00c7))
SELECT @vcResult = REPLACE(@vcResult, 'È', NCHAR(0x00c8))
SELECT @vcResult = REPLACE(@vcResult, 'É', NCHAR(0x00c9))
SELECT @vcResult = REPLACE(@vcResult, 'Ê', NCHAR(0x00ca))
SELECT @vcResult = REPLACE(@vcResult, 'Ë', NCHAR(0x00cb))
SELECT @vcResult = REPLACE(@vcResult, 'Ì', NCHAR(0x00cc))
SELECT @vcResult = REPLACE(@vcResult, 'Í', NCHAR(0x00cd))
SELECT @vcResult = REPLACE(@vcResult, 'Î', NCHAR(0x00ce ))
SELECT @vcResult = REPLACE(@vcResult, 'Ï', NCHAR(0x00cf))
SELECT @vcResult = REPLACE(@vcResult, 'Ð', NCHAR(0x00d0))
SELECT @vcResult = REPLACE(@vcResult, 'Ñ', NCHAR(0x00d1))
SELECT @vcResult = REPLACE(@vcResult, 'Ò', NCHAR(0x00d2))
SELECT @vcResult = REPLACE(@vcResult, 'Ó', NCHAR(0x00d3))
SELECT @vcResult = REPLACE(@vcResult, 'Ô', NCHAR(0x00d4))
SELECT @vcResult = REPLACE(@vcResult, 'Õ', NCHAR(0x00d5))
SELECT @vcResult = REPLACE(@vcResult, 'Ö', NCHAR(0x00d6))
SELECT @vcResult = REPLACE(@vcResult, '×', NCHAR(0x00d7))
SELECT @vcResult = REPLACE(@vcResult, 'Ø', NCHAR(0x00d8))
SELECT @vcResult = REPLACE(@vcResult, 'Ù', NCHAR(0x00d9))
SELECT @vcResult = REPLACE(@vcResult, 'Ú', NCHAR(0x00da))
SELECT @vcResult = REPLACE(@vcResult, 'Û', NCHAR(0x00db))
SELECT @vcResult = REPLACE(@vcResult, 'Ü', NCHAR(0x00dc))
SELECT @vcResult = REPLACE(@vcResult, 'Ý', NCHAR(0x00dd))
SELECT @vcResult = REPLACE(@vcResult, 'Þ', NCHAR(0x00de))
SELECT @vcResult = REPLACE(@vcResult, 'ß', NCHAR(0x00df))
SELECT @vcResult = REPLACE(@vcResult, 'à', NCHAR(0x00e0))
SELECT @vcResult = REPLACE(@vcResult, 'á', NCHAR(0x00e1))
SELECT @vcResult = REPLACE(@vcResult, 'â', NCHAR(0x00e2))
SELECT @vcResult = REPLACE(@vcResult, 'ã', NCHAR(0x00e3))
SELECT @vcResult = REPLACE(@vcResult, 'ä', NCHAR(0x00e4))
SELECT @vcResult = REPLACE(@vcResult, 'å', NCHAR(0x00e5))
SELECT @vcResult = REPLACE(@vcResult, 'æ', NCHAR(0x00e6))
SELECT @vcResult = REPLACE(@vcResult, 'ç', NCHAR(0x00e7))
SELECT @vcResult = REPLACE(@vcResult, 'è', NCHAR(0x00e8))
SELECT @vcResult = REPLACE(@vcResult, 'é', NCHAR(0x00e9))
SELECT @vcResult = REPLACE(@vcResult, 'ê', NCHAR(0x00ea))
SELECT @vcResult = REPLACE(@vcResult, 'ë', NCHAR(0x00eb))
SELECT @vcResult = REPLACE(@vcResult, 'ì', NCHAR(0x00ec))
SELECT @vcResult = REPLACE(@vcResult, 'í', NCHAR(0x00ed))
SELECT @vcResult = REPLACE(@vcResult, 'î', NCHAR(0x00ee))
SELECT @vcResult = REPLACE(@vcResult, 'ï', NCHAR(0x00ef))
SELECT @vcResult = REPLACE(@vcResult, 'ð', NCHAR(0x00f0))
SELECT @vcResult = REPLACE(@vcResult, 'ñ', NCHAR(0x00f1))
SELECT @vcResult = REPLACE(@vcResult, 'ò', NCHAR(0x00f2))
SELECT @vcResult = REPLACE(@vcResult, 'ó', NCHAR(0x00f3))
SELECT @vcResult = REPLACE(@vcResult, 'ô', NCHAR(0x00f4))
SELECT @vcResult = REPLACE(@vcResult, 'õ', NCHAR(0x00f5))
SELECT @vcResult = REPLACE(@vcResult, 'ö', NCHAR(0x00f6))
SELECT @vcResult = REPLACE(@vcResult, '÷', NCHAR(0x00f7))
SELECT @vcResult = REPLACE(@vcResult, 'ø', NCHAR(0x00f8))
SELECT @vcResult = REPLACE(@vcResult, 'ù', NCHAR(0x00f9))
SELECT @vcResult = REPLACE(@vcResult, 'ú', NCHAR(0x00fa))
SELECT @vcResult = REPLACE(@vcResult, 'û', NCHAR(0x00fb))
SELECT @vcResult = REPLACE(@vcResult, 'ü', NCHAR(0x00fc))
SELECT @vcResult = REPLACE(@vcResult, 'ý', NCHAR(0x00fd))
SELECT @vcResult = REPLACE(@vcResult, 'þ', NCHAR(0x00fe))
SELECT @vcResult = REPLACE(@vcResult, 'ÿ', NCHAR(0x00ff))
SELECT @vcResult = REPLACE(@vcResult, 'Œ', NCHAR(0x0152))
SELECT @vcResult = REPLACE(@vcResult, 'œ', NCHAR(0x0153))
SELECT @vcResult = REPLACE(@vcResult, 'Š', NCHAR(0x0160))
SELECT @vcResult = REPLACE(@vcResult, 'š', NCHAR(0x0161))
SELECT @vcResult = REPLACE(@vcResult, 'Ÿ', NCHAR(0x0178))
SELECT @vcResult = REPLACE(@vcResult, 'ƒ', NCHAR(0x0192))
SELECT @vcResult = REPLACE(@vcResult, 'ˆ', NCHAR(0x02c6))
SELECT @vcResult = REPLACE(@vcResult, '˜', NCHAR(0x02dc))
SELECT @vcResult = REPLACE(@vcResult, 'Α', NCHAR(0x0391))
SELECT @vcResult = REPLACE(@vcResult, 'Β', NCHAR(0x0392))
SELECT @vcResult = REPLACE(@vcResult, 'Γ', NCHAR(0x0393))
SELECT @vcResult = REPLACE(@vcResult, 'Δ', NCHAR(0x0394))
SELECT @vcResult = REPLACE(@vcResult, 'Ε', NCHAR(0x0395))
SELECT @vcResult = REPLACE(@vcResult, 'Ζ', NCHAR(0x0396))
SELECT @vcResult = REPLACE(@vcResult, 'Η', NCHAR(0x0397))
SELECT @vcResult = REPLACE(@vcResult, 'Θ', NCHAR(0x0398))
SELECT @vcResult = REPLACE(@vcResult, 'Ι', NCHAR(0x0399))
SELECT @vcResult = REPLACE(@vcResult, 'Κ', NCHAR(0x039a))
SELECT @vcResult = REPLACE(@vcResult, 'Λ', NCHAR(0x039b))
SELECT @vcResult = REPLACE(@vcResult, 'Μ', NCHAR(0x039c))
SELECT @vcResult = REPLACE(@vcResult, 'Ν', NCHAR(0x039d))
SELECT @vcResult = REPLACE(@vcResult, 'Ξ', NCHAR(0x039e))
SELECT @vcResult = REPLACE(@vcResult, 'Ο', NCHAR(0x039f))
SELECT @vcResult = REPLACE(@vcResult, 'Π', NCHAR(0x03a0))
SELECT @vcResult = REPLACE(@vcResult, '& Rho ;', NCHAR(0x03a1))
SELECT @vcResult = REPLACE(@vcResult, 'Σ', NCHAR(0x03a3))
SELECT @vcResult = REPLACE(@vcResult, 'Τ', NCHAR(0x03a4))
SELECT @vcResult = REPLACE(@vcResult, 'Υ', NCHAR(0x03a5))
SELECT @vcResult = REPLACE(@vcResult, 'Φ', NCHAR(0x03a6))
SELECT @vcResult = REPLACE(@vcResult, 'Χ', NCHAR(0x03a7))
SELECT @vcResult = REPLACE(@vcResult, 'Ψ', NCHAR(0x03a8))
SELECT @vcResult = REPLACE(@vcResult, 'Ω', NCHAR(0x03a9))
SELECT @vcResult = REPLACE(@vcResult, 'α', NCHAR(0x03b1))
SELECT @vcResult = REPLACE(@vcResult, 'β', NCHAR(0x03b2))
SELECT @vcResult = REPLACE(@vcResult, 'γ', NCHAR(0x03b3))
SELECT @vcResult = REPLACE(@vcResult, 'δ', NCHAR(0x03b4))
SELECT @vcResult = REPLACE(@vcResult, 'ε', NCHAR(0x03b5))
SELECT @vcResult = REPLACE(@vcResult, 'ζ', NCHAR(0x03b6))
SELECT @vcResult = REPLACE(@vcResult, 'η', NCHAR(0x03b7))
SELECT @vcResult = REPLACE(@vcResult, 'θ', NCHAR(0x03b8))
SELECT @vcResult = REPLACE(@vcResult, 'ι', NCHAR(0x03b9))
SELECT @vcResult = REPLACE(@vcResult, 'κ', NCHAR(0x03ba))
SELECT @vcResult = REPLACE(@vcResult, 'λ', NCHAR(0x03bb))
SELECT @vcResult = REPLACE(@vcResult, 'μ', NCHAR(0x03bc))
SELECT @vcResult = REPLACE(@vcResult, 'ν', NCHAR(0x03bd))
SELECT @vcResult = REPLACE(@vcResult, 'ξ', NCHAR(0x03be))
SELECT @vcResult = REPLACE(@vcResult, 'ο', NCHAR(0x03bf))
SELECT @vcResult = REPLACE(@vcResult, 'π', NCHAR(0x03c0))
SELECT @vcResult = REPLACE(@vcResult, 'ρ', NCHAR(0x03c1))
SELECT @vcResult = REPLACE(@vcResult, 'ς', NCHAR(0x03c2))
SELECT @vcResult = REPLACE(@vcResult, 'σ', NCHAR(0x03c3))
SELECT @vcResult = REPLACE(@vcResult, 'τ', NCHAR(0x03c4))
SELECT @vcResult = REPLACE(@vcResult, 'υ', NCHAR(0x03c5))
SELECT @vcResult = REPLACE(@vcResult, 'φ', NCHAR(0x03c6))
SELECT @vcResult = REPLACE(@vcResult, 'χ', NCHAR(0x03c7))
SELECT @vcResult = REPLACE(@vcResult, 'ψ', NCHAR(0x03c8))
SELECT @vcResult = REPLACE(@vcResult, 'ω', NCHAR(0x03c9))
SELECT @vcResult = REPLACE(@vcResult, 'ϑ', NCHAR(0x03d1))
SELECT @vcResult = REPLACE(@vcResult, 'ϒ', NCHAR(0x03d2))
SELECT @vcResult = REPLACE(@vcResult, 'ϖ', NCHAR(0x03d6))
SELECT @vcResult = REPLACE(@vcResult, ' ', NCHAR(0x2002))
SELECT @vcResult = REPLACE(@vcResult, ' ', NCHAR(0x2003))
SELECT @vcResult = REPLACE(@vcResult, ' ', NCHAR(0x2009))
SELECT @vcResult = REPLACE(@vcResult, '‌', NCHAR(0x200c))
SELECT @vcResult = REPLACE(@vcResult, '‍', NCHAR(0x200d))
SELECT @vcResult = REPLACE(@vcResult, '‎', NCHAR(0x200e))
SELECT @vcResult = REPLACE(@vcResult, '‏', NCHAR(0x200f))
SELECT @vcResult = REPLACE(@vcResult, '–', NCHAR(0x2013))
SELECT @vcResult = REPLACE(@vcResult, '—', NCHAR(0x2014))
SELECT @vcResult = REPLACE(@vcResult, '‘', NCHAR(0x2018))
SELECT @vcResult = REPLACE(@vcResult, '’', NCHAR(0x2019))
SELECT @vcResult = REPLACE(@vcResult, '‚', NCHAR(0x201a))
SELECT @vcResult = REPLACE(@vcResult, '“', NCHAR(0x201c))
SELECT @vcResult = REPLACE(@vcResult, '”', NCHAR(0x201d))
SELECT @vcResult = REPLACE(@vcResult, '„', NCHAR(0x201e))
SELECT @vcResult = REPLACE(@vcResult, '†', NCHAR(0x2020))
SELECT @vcResult = REPLACE(@vcResult, '‡', NCHAR(0x2021))
SELECT @vcResult = REPLACE(@vcResult, '•', NCHAR(0x2022))
SELECT @vcResult = REPLACE(@vcResult, '…', NCHAR(0x2026))
SELECT @vcResult = REPLACE(@vcResult, '‰', NCHAR(0x2030))
SELECT @vcResult = REPLACE(@vcResult, '′', NCHAR(0x2032))
SELECT @vcResult = REPLACE(@vcResult, '″', NCHAR(0x2033))
SELECT @vcResult = REPLACE(@vcResult, '‹', NCHAR(0x2039))
SELECT @vcResult = REPLACE(@vcResult, '›', NCHAR(0x203a))
SELECT @vcResult = REPLACE(@vcResult, '‾', NCHAR(0x203e))
SELECT @vcResult = REPLACE(@vcResult, '⁄', NCHAR(0x2044))
SELECT @vcResult = REPLACE(@vcResult, '€', NCHAR(0x20ac))
SELECT @vcResult = REPLACE(@vcResult, 'ℑ', NCHAR(0x2111))
SELECT @vcResult = REPLACE(@vcResult, '℘', NCHAR(0x2118))
SELECT @vcResult = REPLACE(@vcResult, 'ℜ', NCHAR(0x211c))
SELECT @vcResult = REPLACE(@vcResult, '™', NCHAR(0x2122))
SELECT @vcResult = REPLACE(@vcResult, 'ℵ', NCHAR(0x2135))
SELECT @vcResult = REPLACE(@vcResult, '←', NCHAR(0x2190))
SELECT @vcResult = REPLACE(@vcResult, '↑', NCHAR(0x2191))
SELECT @vcResult = REPLACE(@vcResult, '→', NCHAR(0x2192))
SELECT @vcResult = REPLACE(@vcResult, '↓', NCHAR(0x2193))
SELECT @vcResult = REPLACE(@vcResult, '↔', NCHAR(0x2194))
SELECT @vcResult = REPLACE(@vcResult, '↵', NCHAR(0x21b5))
SELECT @vcResult = REPLACE(@vcResult, '⇐', NCHAR(0x21d0))
SELECT @vcResult = REPLACE(@vcResult, '⇑', NCHAR(0x21d1))
SELECT @vcResult = REPLACE(@vcResult, '⇒', NCHAR(0x21d2))
SELECT @vcResult = REPLACE(@vcResult, '⇓', NCHAR(0x21d3))
SELECT @vcResult = REPLACE(@vcResult, '⇔', NCHAR(0x21d4))
SELECT @vcResult = REPLACE(@vcResult, '∀', NCHAR(0x2200))
SELECT @vcResult = REPLACE(@vcResult, '∂', NCHAR(0x2202))
SELECT @vcResult = REPLACE(@vcResult, '∃', NCHAR(0x2203))
SELECT @vcResult = REPLACE(@vcResult, '∅', NCHAR(0x2205))
SELECT @vcResult = REPLACE(@vcResult, '∇', NCHAR(0x2207))
SELECT @vcResult = REPLACE(@vcResult, '∈', NCHAR(0x2208))
SELECT @vcResult = REPLACE(@vcResult, '∉', NCHAR(0x2209))
SELECT @vcResult = REPLACE(@vcResult, '∋', NCHAR(0x220b))
SELECT @vcResult = REPLACE(@vcResult, '∏', NCHAR(0x220f))
SELECT @vcResult = REPLACE(@vcResult, '∑', NCHAR(0x2211))
SELECT @vcResult = REPLACE(@vcResult, '−', NCHAR(0x2212))
SELECT @vcResult = REPLACE(@vcResult, '∗', NCHAR(0x2217))
SELECT @vcResult = REPLACE(@vcResult, '√', NCHAR(0x221a))
SELECT @vcResult = REPLACE(@vcResult, '∝', NCHAR(0x221d))
SELECT @vcResult = REPLACE(@vcResult, '∞', NCHAR(0x221e))
SELECT @vcResult = REPLACE(@vcResult, '∠', NCHAR(0x2220))
SELECT @vcResult = REPLACE(@vcResult, '∧', NCHAR(0x2227))
SELECT @vcResult = REPLACE(@vcResult, '∨', NCHAR(0x2228))
SELECT @vcResult = REPLACE(@vcResult, '∩', NCHAR(0x2229))
SELECT @vcResult = REPLACE(@vcResult, '∪', NCHAR(0x222a))
SELECT @vcResult = REPLACE(@vcResult, '∫', NCHAR(0x222b))
SELECT @vcResult = REPLACE(@vcResult, '∴', NCHAR(0x2234))
SELECT @vcResult = REPLACE(@vcResult, '∼', NCHAR(0x223c))
SELECT @vcResult = REPLACE(@vcResult, '≅', NCHAR(0x2245))
SELECT @vcResult = REPLACE(@vcResult, '≈', NCHAR(0x2248))
SELECT @vcResult = REPLACE(@vcResult, '≠', NCHAR(0x2260))
SELECT @vcResult = REPLACE(@vcResult, '≡', NCHAR(0x2261))
SELECT @vcResult = REPLACE(@vcResult, '≤', NCHAR(0x2264))
SELECT @vcResult = REPLACE(@vcResult, '≥', NCHAR(0x2265))
SELECT @vcResult = REPLACE(@vcResult, '⊂', NCHAR(0x2282))
SELECT @vcResult = REPLACE(@vcResult, '⊃', NCHAR(0x2283))
SELECT @vcResult = REPLACE(@vcResult, '⊄', NCHAR(0x2284))
SELECT @vcResult = REPLACE(@vcResult, '⊆', NCHAR(0x2286))
SELECT @vcResult = REPLACE(@vcResult, '⊇', NCHAR(0x2287))
SELECT @vcResult = REPLACE(@vcResult, '⊕', NCHAR(0x2295))
SELECT @vcResult = REPLACE(@vcResult, '⊗', NCHAR(0x2297))
SELECT @vcResult = REPLACE(@vcResult, '⊥', NCHAR(0x22a5))
SELECT @vcResult = REPLACE(@vcResult, '⋅', NCHAR(0x22c5))
SELECT @vcResult = REPLACE(@vcResult, '⌈', NCHAR(0x2308))
SELECT @vcResult = REPLACE(@vcResult, '⌉', NCHAR(0x2309))
SELECT @vcResult = REPLACE(@vcResult, '⌊', NCHAR(0x230a))
SELECT @vcResult = REPLACE(@vcResult, '⌋', NCHAR(0x230b))
SELECT @vcResult = REPLACE(@vcResult, '⟨', NCHAR(0x2329))
SELECT @vcResult = REPLACE(@vcResult, '⟩', NCHAR(0x232a))
SELECT @vcResult = REPLACE(@vcResult, '◊', NCHAR(0x25ca))
SELECT @vcResult = REPLACE(@vcResult, '♠', NCHAR(0x2660))
SELECT @vcResult = REPLACE(@vcResult, '♣', NCHAR(0x2663))
SELECT @vcResult = REPLACE(@vcResult, '♥', NCHAR(0x2665))
SELECT @vcResult = REPLACE(@vcResult, '♦', NCHAR(0x2666))

SELECT @vcResult = REPLACE(@vcResult, '<P>', @vcCrLf)

RETURN @vcResult
END


TalalUser is Offline
New Member
New Member
Posts:90

--
02 May 2008 09:21 AM  
Ooops.. the chars were converted for the function... try to see the source html it maybe better


pauldesUser is Offline
Veteran Member
Veteran Member
Posts:1392

--
02 May 2008 02:05 PM  
Talal, can you put the function in a text file and upload as an attachment? Thx


ListX....makes you look brilliant, even though you're not.
rickwpUser is Offline
New Member
New Member
Posts:92

--
02 May 2008 02:36 PM  
That solves the problem with data entry forms. It does not solve the problem with a data listing that I had. If the field contains a pair of [ ] and a {left:10} format tag splits up the pair, the whole line gets totally messed up. I tried to use a nested format with this [format,"[$Title,{ENCODEHTML}]",{LEFT:10}] and while this does output the proper field data, it does not process the truncation part of the set and instead just pads the field data with the format code like this [format,"text [WITH brackets]",{LEFT:10}] instead of displaying "text [WITH" in its truncated value. So, while the encodehtml works fine by itself, the truncating formatter does not, but I can't seem to combine the two formats and have it work. I guess as long as you don't want to truncate a 5 paragraph text area you are fine, but if you do, then it's all messed up again. Unless you are a sql guru and want to write a sql decodehtml function to run at the database level. I also tried this with decodehtml, and the output was the same when trying to truncate.

Anyway, half solved is progress. Thanks!

Rick


TalalUser is Offline
New Member
New Member
Posts:90

--
02 May 2008 06:40 PM  
---
(sorry in my previous note i missed the 'dbo.' before the function name in the query)
should read dbo.HTMLDecode(@CustomerComments)
---


There is no doubt that there is a problem with the way ListX handles this.

In any programming language i dealt with before we escape one character when assigning.
for example in VB:
sString = "This is ""My Test"". and would work"

in Java Script
var sString='This is \'My Test\'. and would work';

In ListX there are just too many and the problem is IMHO is that it does not use surrounding quotes.

[Format,Value,{Formatter}]

If you use something like:
[FORMAT, My Name,{Left:2}]
or
[FORMAT, "My Name",{Left:2}]
both would work.

IMHO that is wrong.
The first one should NOT work.

Now once you force surrounding quotes then you can ignore anything inside them because you will know they are a VALUE and nothing else.


I am hoping that BI4CE is reading because this has been a major issue with applications i write with ListX and hope that this has been addressed in the new release (not tested yet).


Rick; However I believe in your example it is a bit different:
I would never truncate and save. You may need to do extra checks and know what you are truncating.

Here are some scenarios:
1. "This is a < b >sample</ b > text"
2. "This is a 'Sample' text"
3. "This is a ""Sample"" text"

If you get the first 5 characters of the string is fine but what if you break an HTML tag?
What if you break a quote, double quotes, or even double single quotes?

One way I would do some 'magic' formatting or processing in the TSQL with ListX is use the TSQL.


Here are some samples:

Update tblTest set
sTextField = SomeCustomFunctionThatProcessesText(dbo.HTMLDecode(@CustomerComments)),
sIntField = case when IsNumeric(@sintValue)=1 then @sintValue else null end,
sDateField = case when IsDate(@sDateValue)=1 then @sDateValue else null end

Where ID = case when IsNumeric(@ID) = 1 then @ID else -1 end


We jsut need to be creative with the TSQL and we can have more power.
Dont be shy to make user functions.
Hope this helps someone.


TalalUser is Offline
New Member
New Member
Posts:90

--
02 May 2008 06:58 PM  
hmmm dont seem to be able to attach anything here..
I out the zip under:

http://www.SymphonyOfFire.com/HTMLDecode.zip

Please download it (i will have to remove it in few days)

If you can attach to this post would be great thx


pauldesUser is Offline
Veteran Member
Veteran Member
Posts:1392

--
02 May 2008 07:47 PM  
Thanks, got it....

FYI, instead of using the Quck Reply form, click the Add Reply link on this page and a form will open to browse for an attachment.


ListX....makes you look brilliant, even though you're not.
robert_chumleyUser is Offline
Advanced Member
Advanced Member
Posts:592

--
02 May 2008 08:16 PM  
Yes, and it would also be helpful if you can upload your entire configuration so we can see what is actually happening.
thanks,


Robert Chumley<br>r2integrated (formally bi4ce)
TalalUser is Offline
New Member
New Member
Posts:90

--
02 May 2008 08:25 PM  
Thanks Paul i did not know.. attached.

Robert; This can easily be replicated by creating a simple listX and text field.

I experienced the situation over and over again.

I don't have a configuration file i can upload at this point.. If someone else does plz upload here.

I may have sometime over the weekend to make a small test and upload it.. (sorry overwhelmed with projects)

<img src='desktopmodules/ntforums/images/emoticons/smile.gif' height='20' width='20' border='0' title='Smile' align='absmiddle'>

Thank you

Attachment: HTMLDecode..zip

robert_chumleyUser is Offline
Advanced Member
Advanced Member
Posts:592

--
08 May 2008 05:05 PM  
Also, be sure to use ListX Variables any time you pull information from a form.

Thanks,


Robert Chumley<br>r2integrated (formally bi4ce)
TalalUser is Offline
New Member
New Member
Posts:90

--
09 May 2008 02:37 AM  
Rob, there are times when it is not possible to use variables.


robert_chumleyUser is Offline
Advanced Member
Advanced Member
Posts:592

--
09 May 2008 02:54 PM  
Hey Talal,
Can you possibly describe this scenario more adequatly? I am not familiar with any scenarios where you cannot use variables in ListX. Maybe if you are putting HTML in the header or footer of the module.
Thanks,


Robert Chumley<br>r2integrated (formally bi4ce)
You are not authorized to post a reply.
Page 1 of 212 > >>


Active Forums 4.1
 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seatle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share