home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 1999 April / APC443.iso / features / grpware / coldfus / coldfusi.exe / data1.cab / Documentation / snippets / right.cfm < prev    next >
Encoding:
Text File  |  1998-10-08  |  1.3 KB  |  60 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. <BODY bgcolor=silver>
  12.  
  13. <H3>Right Example</H3>
  14.  
  15. <CFIF IsDefined("Form.MyText")>
  16. <!--- if len is 0, then err --->
  17.     <CFIF Len(form.myText) is not 0>
  18.         <CFIF Len(form.myText) LTE form.RemoveChars>
  19.         <P>Your string <CFOUTPUT>#form.myText#</cFOUTPUT>
  20.         only has <CFOUTPUT>#Len(form.myText)#</cFOUTPUT>
  21.         characters.  You cannot output the <CFOUTPUT>#form.removeChars#</cFOUTPUT>
  22.         rightmost characters of this string because it is not long enough
  23.         <CFELSE>
  24.         
  25.         <P>Your original string: <CFOUTPUT>#form.myText#</CFOUTPUT>
  26.         <P>Your changed string, showing only the <CFOUTPUT>#form.removeChars#</CFOUTPUT> rightmost characters:
  27.         <CFOUTPUT>#right("#Form.myText#", "#form.removeChars#")#</CFOUTPUT>
  28.  
  29.         </CFIF>
  30.  
  31.  
  32.  
  33.     <CFELSE>
  34.  
  35.     <P>Please enter a string
  36.     </CFIF>
  37.  
  38.  
  39.  
  40. </CFIF>
  41.  
  42. <FORM ACTION="right.cfm" METHOD="POST">
  43. <P>Type in some text
  44.  
  45. <BR><INPUT TYPE="Text" NAME="MyText">
  46.  
  47. <P>How many characters from the right do you want to show?
  48. <SELECT NAME="RemoveChars">
  49.    <OPTION VALUE="1">1
  50.    <OPTION VALUE="3" SELECTED>3
  51.    <OPTION VALUE="5">5
  52.    <OPTION VALUE="7">7
  53.    <OPTION VALUE="9">9</SELECT>
  54.  
  55. <INPUT TYPE="Submit" NAME="Remove characters">
  56.  
  57. </FORM>
  58. </BODY>
  59. </HTML>       
  60.