dbTalk Databases Forums  

change text by validation

comp.databases.filemaker comp.databases.filemaker


Discuss change text by validation in the comp.databases.filemaker forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Bill Steele
 
Posts: n/a

Default change text by validation - 10-06-2009 , 02:42 PM






I have a text field that eventually ends up on the web, so want to be
sure no one pastes in curly quotes or apostrophes. So I set up a
validation on leaving the field to substitute straight quotes for curly.
Works OK. but if there are no curly things in the fierld it gives an
error message: This field is defined to contain only certain values."

So I wrapped the substitute in an if statement. If the position of the
quote is not 0, do the substitution. Still gives me that error.

I can do it in FM 10 with a script trigger, but not every user has 10.

Suggestions?

Reply With Quote
  #2  
Old   
Your Name
 
Posts: n/a

Default Re: change text by validation - 10-06-2009 , 03:00 PM






"Bill Steele" <ws21 (AT) cornell (DOT) edu> wrote

Quote:
I have a text field that eventually ends up on the web, so want to be
sure no one pastes in curly quotes or apostrophes. So I set up a
validation on leaving the field to substitute straight quotes for curly.
Works OK. but if there are no curly things in the fierld it gives an
error message: This field is defined to contain only certain values."

So I wrapped the substitute in an if statement. If the position of the
quote is not 0, do the substitution. Still gives me that error.

I can do it in FM 10 with a script trigger, but not every user has 10.

Suggestions?
The simplest option is to use a new Calculation Field that replaces all the
unwanted characters, and then use that Field for the web.
i.e.
WebField Calculation, Text Result, Unstored
= Substitute(OriginalField, CurlyQuote, StraightQuote)

As well as curly quotes (depending on what's being entered), you may need to
also replace curly apostrophes, long dashes (em-dash, etc.), "&" characters,
copyright / registered / TM symbols, ...

You could of course replace these things with the correct HTML &codes. I've
never used the web side of FileMaker, but I would have thought it should do
such things automatically.

Helpfull Harry )

Reply With Quote
  #3  
Old   
Bill Steele
 
Posts: n/a

Default Re: change text by validation - 10-07-2009 , 01:47 PM



In article <hag7il$35o$1 (AT) lust (DOT) ihug.co.nz>,
"Your Name" <your.name (AT) isp (DOT) com> wrote:

Quote:
"Bill Steele" <ws21 (AT) cornell (DOT) edu> wrote in message
news:ws21-9AB65B.15425406102009 (AT) newsstand (DOT) cit.cornell.edu...
I have a text field that eventually ends up on the web, so want to be
sure no one pastes in curly quotes or apostrophes. So I set up a
validation on leaving the field to substitute straight quotes for curly.
Works OK. but if there are no curly things in the fierld it gives an
error message: This field is defined to contain only certain values."

So I wrapped the substitute in an if statement. If the position of the
quote is not 0, do the substitution. Still gives me that error.

I can do it in FM 10 with a script trigger, but not every user has 10.

Suggestions?

The simplest option is to use a new Calculation Field that replaces all the
unwanted characters, and then use that Field for the web.
i.e.
WebField Calculation, Text Result, Unstored
= Substitute(OriginalField, CurlyQuote, StraightQuote)
That should work. Thanks.
Quote:
As well as curly quotes (depending on what's being entered), you may need to
also replace curly apostrophes, long dashes (em-dash, etc.), "&" characters,
copyright / registered / TM symbols, ...

You could of course replace these things with the correct HTML &codes. I've
never used the web side of FileMaker, but I would have thought it should do
such things automatically.

It does when you put a whole database on the web, but here we're pulling
text out of various fields and rearranging it. There is a "Get as CSS"
function that generates HTML, but like very other automatic HTML
generator it produces messy code that needs about 40 lines of script to
clean up. For this particular field I can just wrap the text in <p></p>
and it's done.

Reply With Quote
  #4  
Old   
Ursus
 
Posts: n/a

Default Re: change text by validation - 10-07-2009 , 01:55 PM



some signs have to be escaped before using them in a litteral string
"\"" results in one "
"\\" results in \
complete list is: @, *, #, ?, !, =, <, >, "

Samething goes for searching, replacing etc. These signs have to be escape
with a \

--
Keep well / Hou je goed

Ursus
"Bill Steele" <ws21 (AT) cornell (DOT) edu> schreef in bericht
news:ws21-9AB65B.15425406102009 (AT) newsstand (DOT) cit.cornell.edu...
Quote:
I have a text field that eventually ends up on the web, so want to be
sure no one pastes in curly quotes or apostrophes. So I set up a
validation on leaving the field to substitute straight quotes for curly.
Works OK. but if there are no curly things in the fierld it gives an
error message: This field is defined to contain only certain values."

So I wrapped the substitute in an if statement. If the position of the
quote is not 0, do the substitution. Still gives me that error.

I can do it in FM 10 with a script trigger, but not every user has 10.

Suggestions?

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.