home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / right.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.3 KB  |  61 lines

  1. <!---  This example shows the use of Right --->
  2.  
  3. <HTML>
  4.  
  5. <HEAD>
  6. <TITLE>
  7. Right Example
  8. </TITLE>
  9. </HEAD>
  10.  
  11. <BASEFONT FACE="Arial, Helvetica" SIZE=2>
  12. <BODY  bgcolor="#FFFFD5">
  13.  
  14. <H3>Right Example</H3>
  15.  
  16. <CFIF IsDefined("Form.MyText")>
  17. <!--- if len is 0, then err --->
  18.     <CFIF Len(form.myText) is not 0>
  19.         <CFIF Len(form.myText) LTE form.RemoveChars>
  20.         <P>Your string <CFOUTPUT>#form.myText#</cFOUTPUT>
  21.         only has <CFOUTPUT>#Len(form.myText)#</cFOUTPUT>
  22.         characters.  You cannot output the <CFOUTPUT>#form.removeChars#</cFOUTPUT>
  23.         rightmost characters of this string because it is not long enough
  24.         <CFELSE>
  25.         
  26.         <P>Your original string: <CFOUTPUT>#form.myText#</CFOUTPUT>
  27.         <P>Your changed string, showing only the <CFOUTPUT>#form.removeChars#</CFOUTPUT> rightmost characters:
  28.         <CFOUTPUT>#right(Form.myText, form.removeChars)#</CFOUTPUT>
  29.  
  30.         </CFIF>
  31.  
  32.  
  33.  
  34.     <CFELSE>
  35.  
  36.     <P>Please enter a string
  37.     </CFIF>
  38.  
  39.  
  40.  
  41. </CFIF>
  42.  
  43. <FORM ACTION="right.cfm" METHOD="POST">
  44. <P>Type in some text
  45.  
  46. <BR><INPUT TYPE="Text" NAME="MyText">
  47.  
  48. <P>How many characters from the right do you want to show?
  49. <SELECT NAME="RemoveChars">
  50.    <OPTION VALUE="1">1
  51.    <OPTION VALUE="3" SELECTED>3
  52.    <OPTION VALUE="5">5
  53.    <OPTION VALUE="7">7
  54.    <OPTION VALUE="9">9</SELECT>
  55.  
  56. <INPUT TYPE="Submit" NAME="Remove characters">
  57.  
  58. </FORM>
  59. </BODY>
  60. </HTML>       
  61.