• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

capitalised first letter

Guest
Jul 15, 2006 Jul 15, 2006

Copy link to clipboard

Copied

Hi i have a form which is passed to this insert query below, i need the first letters of firstname and surname to be capitalised if they are not in the form, is this possible?

<cfquery name="Insert datasource="Users">
INSERT INTO TempUsers
(Name, firstName, Surname, EmailAddress, Password)
VALUES
('#form.FirstName#', '#form.Surname#', '#form.EmailAddress#', '#form.password#')
</cfquery>
TOPICS
Advanced techniques

Views

247

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 16, 2006 Jul 16, 2006

Copy link to clipboard

Copied

NewWord = ucase(left(OldWord, 1)) & right(OldWord, len(OldWord) -1);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 16, 2006 Jul 16, 2006

Copy link to clipboard

Copied

LATEST
Place this function in say the top of the page then use the function anywhere in the page. You could also create it in the request scope and use it just there or make it permament. Your choice.

<!------------------------------------------------------------------>
<!--- Return string with initial letter capitalized. --->
<!------------------------------------------------------------------>
<cfscript>
function capitalizeFirstLetter(word) {
return UCase(Mid(word,1, 1)) & LCase(mid(word, 2, len(word)));
}
</cfscript>

<cfquery name="Insert datasource="Users">
INSERT INTO TempUsers
(Name, firstName, Surname, EmailAddress, Password)
VALUES
('#capitalizeFirstLetter(form.FirstName#)', '#capitalizeFirstLetter(form.Surname)#', '#form.EmailAddress#', '#form.password#')
</cfquery>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation