Question
isValid("uuid",i) Problems
Hi,
I'm in the process of building me a CMS. The fields are dynamic and pulled from a database, because of this, it made sense to make each fields name a UUID. So far so good.
So what I do is take the form.fieldnames scope and loop it, using the name of the field (UUID) and some logic to put this in the DB. However, there are other elements on the form that I do not want in the DB, such as the submit button etc, that the form.fieldnames scope puts in.
In order to avoid this, before my insert query, I check the Index of my loop (a list loop from form.fieldnames) to see if the index is a valid UUID. This would mean I would then KNOW it's the kind of field I want to put in.
However, i then noticed some fields were not getting inserted - taking this condition out...they got inserted...BUT, I need to use this condition...and it's failing but I cannot understand why.
Below is a screenshot of some output I got from the loop in my CFC method...
http://www.glasshouseboutique.com/
As you can see, they look like valid ColdFusion UUID's to me, but some return No and some Yes.
Code =
<cfloop index="i" list="#arguments.saveFields#" delimiters=",">
<cfif isValid("uuid",i)>
<cfquery name="checkExists" datasource="#request.dsn#" username="#request.username#" password="#request.password#">
<!---- Query Insert here --->
</cfquery>
</cfif>
<cfoutput>#i# ---- Valid UUID = <strong>#isValid("uuid",i)#</strong><br /></cfoutput>
</cfloop>
I'm puzzled!!
Thanks,
Mikey.
I'm in the process of building me a CMS. The fields are dynamic and pulled from a database, because of this, it made sense to make each fields name a UUID. So far so good.
So what I do is take the form.fieldnames scope and loop it, using the name of the field (UUID) and some logic to put this in the DB. However, there are other elements on the form that I do not want in the DB, such as the submit button etc, that the form.fieldnames scope puts in.
In order to avoid this, before my insert query, I check the Index of my loop (a list loop from form.fieldnames) to see if the index is a valid UUID. This would mean I would then KNOW it's the kind of field I want to put in.
However, i then noticed some fields were not getting inserted - taking this condition out...they got inserted...BUT, I need to use this condition...and it's failing but I cannot understand why.
Below is a screenshot of some output I got from the loop in my CFC method...
http://www.glasshouseboutique.com/
As you can see, they look like valid ColdFusion UUID's to me, but some return No and some Yes.
Code =
<cfloop index="i" list="#arguments.saveFields#" delimiters=",">
<cfif isValid("uuid",i)>
<cfquery name="checkExists" datasource="#request.dsn#" username="#request.username#" password="#request.password#">
<!---- Query Insert here --->
</cfquery>
</cfif>
<cfoutput>#i# ---- Valid UUID = <strong>#isValid("uuid",i)#</strong><br /></cfoutput>
</cfloop>
I'm puzzled!!
Thanks,
Mikey.
