<%page args="element, eaiAttributes, widgetstyle" />

    <div id="item-${element['elementName'] | h}" class="widget ${element['class'] if 'class' in element else '' | h}" ${widgetstyle}>
        % if 'label' in element:
            <label for="${element['elementName'] | h}_id" class="${'disabledLabel ' if element.get('disabled') else ''}">${_(element['label'])}
            % if element.get('elementName') not in eaiAttributes['optionalFields'] or element.has_key('requiredIfVisible'):
                <span class="requiredAsterisk">*</span>
            % endif
            </label>
        % endif
        % if 'helpText' in element:
            <p class="helpText">${_(element['helpText'])}</p>
        % endif
        <div>
            <div class="widgeterror"><form:error name="${element["elementName"]}"/></div>
            <textarea id="${element['elementName'] | h}_id" cols="45" rows="5" class="regular ${element['class'] if 'class' in element else '' | h}" name="${element["elementName"] | h}" ${'disabled="disabled"' if element.get('disabled') else ''}></textarea>
            % if 'exampleText' in element:
                <p class="exampleText"><em>${_(element['exampleText']) | extract_help_links }</em></p>
            % endif
        </div>
    </div>

<script type="text/javascript">
	$(function(){
		var t = new Splunk.TextareaResize( $("#item-${element['elementName']} textarea"), {maxLines:5,pageType:'manager-page'} );
		setTimeout(function(){ t._adjustShadowWidth(); t._resizeSearchBar(); }, 500); //hacky, but fixes a timing bug when eai forms are injected via xhr
	});
</script>
