Ask a Question related to Macromedia ColdFusion, Design and Development.
-
sams@centric.net #1
<cfscript> Auto Capitalizing Question
Hey you cfscript experts! I have an auto-capitalize script that I use
on my forms for capitalizing names and such. If the user enters
ALLCAPS, MiXedCaPs, or all lowercase, it will fix each word by
capitalizing only the first letter. The only problem is with those darn
Irish names such as O'Brien. Is there a way to modify this script so it
will capitalize anything after an apostrophe? (I won't even ask about
names like McDonald!)
Try it out and see what you think:
<cfoutput>
<p><b>Before:</b> <cfif isdefined("Form.Test")>#Form.Test#</cfif>
<p><b>After:</b> <cfif
isdefined("Form.Test")>#AutoCap(Form.Test)#</cfif>
</cfoutput>
<cfscript>
function AutoCap(str) {
var result = Trim(str);
var wordCount = ListLen(result," ");
var ProperString = "";
for(i=1;i LTE wordCount;i=i+1) {
ProperString = ProperString & " " & UCase(Left(ListGetAt(result,i,"
"),1)) & LCase(RemoveChars(ListGetAt(result,i," "),1,1));
} ProperString = Trim(ProperString);
return ProperString;}
</cfscript>
<p>
<form name="form1" method="post" action="TestCap.cfm">
<input type="text" name="Test">
<input type="submit" name="Submit" value="Submit">
</form>
</p>
sams@centric.net Guest
-
cfscript auto capitalize help
Hey you cfscript experts! I have an auto-capitalize script that I use on my forms for capitalizing names and such. If the user enters ALLCAPS,... -
cfscript
since i cannot find the cf and java integration thread, gues i will post this here: i wrote a cfm with cfscript that utilizes java which connects... -
<cfscript> autocaps problem </cfscript> - betcha can't fix this!
First, I'll tell you up front that I am clueless when it comes to cfscript. So I apologize if this question is off topic. I have a nice little... -
Question on DEMO auto or menu controlled modes
Hello group, the sample is at http://developdesign.com/sites/hrc/demo DEMO ARCHITECTURE I've got 4 main layers right now: - layer 0 is base... -
Question: Auto-download ActiveX control if user does not have
I have a webform that uses an ActiveX control. I want the user to automatically download the ActiveX control if he doesn't have it. How can I do...



Reply With Quote

