Yes I did. Had to make some changes though. Still did not produce the 
desired result. Here is what I did:

Original code: newValue was being created inside the cfif's, but was not 
there in the last CFSET. Also, form.FieldNames were not being found 
until I added the loop before the CFIF's. What I get though are x's in 
the first column only if the first column stayed selected. Once I 
selected one of the other two coluns, all fields are blank. And the text 
fields are always blank.

<!--- use single replace for open/close form tag --->
        <cfset NewContentBlock = 
REReplace(contentBlock,"</*form[^>]*>","","ALL")>
        <cfset matches = reMatchNoCase('<input\s+[^>]*>', NewContentBlock)>
        <cfloop array="#matches#" index="element">
                <cfset htmlField = {} >
                <!--- extract field attributes --->
                <cfset attributes = 
reMatchNoCase('((name|value|type)=\"[^\"]*\")', element)> 
                <cfloop array="#attributes#" index="pair">
                        <cfif listLen(pair, "=")>
                                <cfset htmlField[listFirst(pair, "=")] = 
replace(listLast(pair, "="), '"', "", "all")>
                        </cfif>
                </cfloop>
                
                <cfset fieldExists = structCount(htmlField) EQ 3 AND 
listFindNoCase(form.fieldNames, htmlField.name)>
                <cfif fieldExists>
                        <cfset newValue = "">
                        <cfif htmlField.type is "radio">
                                <cfif htmlField.value EQ form[ field.name ]>
                                        <cfset newValue = "x">
                                </cfif>
                        <cfelse>
                                <cfset newValue = form[ field.name ]>
                        </cfif>
                </cfif>

                <cfset NewContentBlock = reReplaceNoCase(NewContentBlock, 
element, newValue, 'all')>
        </cfloop>

Changed code:

<cfoutput query="getContentObjectData">

                   <!--- use single replace for open/close form tag
                <cfset NewContentBlock = 
REReplace(contentBlock,"</*form[^>]*>","","ALL")>
                <cfset matches = reMatchNoCase('<input\s+[^>]*>', 
NewContentBlock)>
                <cfloop array="#matches#" index="element">
                    <cfset htmlField = {} >
                    <!--- extract field attributes --->
                    <cfset attributes = 
reMatchNoCase('((name|value|type)=\"[^\"]*\")', element)>
                    <cfloop array="#attributes#" index="pair">
                        <cfif listLen(pair, "=")>
                            <cfset htmlField[listFirst(pair, "=")] = 
replace(listLast(pair, "="), '"', "", "all")>
                        </cfif>
                       <cfset fieldExists = structCount(htmlField) EQ 3 
AND listFindNoCase(form.fieldNames, htmlField.name)>
                   
                   
                         <cfif fieldExists>
                        <cfset newValue = "">
                        <cfloop collection="#Form#" item="field">
                        <cfif htmlField.type is "radio">
                            <cfif htmlField.value EQ form[field]>
                                <cfset newValue = "x">
                            </cfif>
                        <cfelse>
                            <cfset newValue = form[field]>
                        </cfif>
                        </cfloop>
                    </cfif>
  
                   <cfdump var="#NewValue#">
          
                   <!---  <cfset NewContentBlock = 
reReplaceNoCase(NewContentBlock, element, newValue, 'all')>  --->
                </cfloop>
            </cfloop>
            </cfoutput> --->

C S wrote:
> Did you ever try my last suggestion. It is not ideal, but it should work. 
>   

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:301980
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to