def generateComponentDiv(self, includeLabel=True): # Div tag contains everything about the component componentDiv = Element('div', { 'id': self.id+'-wrapper', 'class': 'jFormComponent '+self._class}) # This causes issues with things that are dependent and should display by default # If the component has dependencies and the display type is hidden, hide by default # if(self.dependencyOptions !== None && isset(self.dependencyOptions['display']) && self.dependencyOptions['display'] == 'hide'): # componentDiv.setAttribute('style', 'display: none') # # Style if self.style: componentDiv.addToAttribute('style', self.style) # Label tag if includeLabel: label = self.generateComponentLabel() componentDiv.insert(label) return componentDiv
def __str__(self): # Generate the component div div = self.generateComponentDiv() # Add the input tag textArea = Element('textarea', { 'id':self.id, 'name':self.name, 'class':self.inputClass}) if self.width: if self.width in self.widthArray.keys(): textArea.setAttribute('style', 'width: '+self.widthArray[self.width]+'') else: textArea.setAttribute('style', 'width: '+str(self.width)+'') if self.height: if self.height in self.heightArray.keys(): textArea.addToAttribute('style', 'height: '+self.heightArray[self.height]+'') else: textArea.addToAttribute('style', 'height: '+str(self.height)+'') if self.style: textArea.addToAttribute('style', self.style) if self.disabled: textArea.setAttribute('disabled', 'disabled') if self.readOnly: textArea.setAttribute('readonly', 'readonly') if self.wrap: textArea.setAttribute('wrap', self.wrap) if self.initialValue: textArea.update(self.initialValue) div.insert(textArea) # Add any description (optional) div = self.insertComponentDescription(div) # Add a tip (optional) div = self.insertComponentTip(div) return div.__str__()