Skip to content

Commit

Permalink
Cleaning array indicators off element names for classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoramite committed Oct 7, 2011
1 parent 5616a5b commit e8cc242
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cf-compendium/inc/resource/structure/form/form.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
<!--- hidden elements should not be shown --->
<cfif local.showLabel>
<!--- Start the tag --->
<cfset formatted = '<div class="element respect-float ' & arguments.element.elementType & ' ' & arguments.element.name & ' ' & arguments.element.elementClass & ' ' & (arguments.element.required ? 'required' : '') & '">' />
<cfset formatted = '<div class="element respect-float ' & arguments.element.elementType & ' ' & __cleanClass(arguments.element.name) & ' ' & arguments.element.elementClass & ' ' & (arguments.element.required ? 'required' : '') & '">' />

<!--- Output the label --->
<cfif not isStruct(arguments.element.label)>
Expand Down Expand Up @@ -701,6 +701,16 @@
<cfreturn toHtml() />
</cffunction>

<cffunction name="__cleanClass" access="private" returntype="string" output="false">
<cfargument name="class" type="string" required="true" />

<cfif len(arguments.class) gt 2 and right(arguments.class, 2) eq '[]'>
<cfset arguments.class = left(arguments.class, len(arguments.class) - 2) />
</cfif>

<cfreturn arguments.class />
</cffunction>

<!---
TODO Remove... debugging purposes only
--->
Expand Down

0 comments on commit e8cc242

Please sign in to comment.