Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1# encoding: utf-8 

2from . import * 

3 

4def textarea( 

5 rows="", 

6 span=2, 

7 placeholder="", 

8 htmlId=False, 

9 inlineHelpText=False, 

10 blockHelpText=False, 

11 focusedInputText=False, 

12 required=False, 

13 disabled=False, 

14 prepopulate=False): 

15 """ 

16 *Generate a textarea - TBS style* 

17 

18 **Key Arguments** 

19 

20 - ``rows`` -- the number of rows the text area should span 

21 - ``span`` -- column span 

22 - ``placeholder`` -- the placeholder text 

23 - ``htmlId`` -- html id for item 

24 - ``inlineHelpText`` -- inline and block level support for help text that appears around form controls 

25 - ``blockHelpText`` -- a longer block of help text that breaks onto a new line and may extend beyond one line 

26 - ``focusedInputText`` -- make the input focused by providing some initial editable input text 

27 - ``required`` -- required attribute if the field is not optional 

28 - ``disabled`` -- add the disabled attribute on an input to prevent user input 

29  

30 

31 **Return** 

32 

33 - ``textarea`` -- the textarea 

34  

35 """ 

36 if span: 

37 span = "span%(span)s" % locals() 

38 else: 

39 span = "" 

40 

41 if inlineHelpText: 

42 inlineHelpText = """<span class="help-inline">%(inlineHelpText)s</span>""" % locals( 

43 ) 

44 else: 

45 inlineHelpText = "" 

46 

47 if blockHelpText: 

48 blockHelpText = """<span class="help-block">%(blockHelpText)s</span>""" % locals( 

49 ) 

50 else: 

51 blockHelpText = "" 

52 

53 if not focusedInputText: 

54 focusedInputText = "" 

55 focusId = "" 

56 else: 

57 focusId = "focusedInput" 

58 

59 if required: 

60 required = """required""" 

61 else: 

62 required = "" 

63 

64 if disabled: 

65 disabled = """disabled""" 

66 disabledId = "disabledId" 

67 else: 

68 disabled = "" 

69 disabledId = "" 

70 

71 if not htmlId: 

72 htmlId = "" 

73 name = "textarea" 

74 else: 

75 name = htmlId 

76 

77 if prepopulate is False: 

78 prepopulate = "" 

79 

80 textarea = """<textarea rows="%(rows)s" class="%(span)s" id="%(htmlId)s%(focusId)s%(disabledId)s" value="%(focusedInputText)s" %(required)s %(disabled)s placeholder="%(placeholder)s" name="%(name)s">%(prepopulate)s</textarea>%(inlineHelpText)s%(blockHelpText)s""" % locals( 

81 ) 

82 

83 return textarea