It's working perfect Charlie, thanks. One small change I made on the second line of the function:
Changed: var stForm = f;
Changed To: var stForm = Duplicate(f);
I wanted to leave the original #form# intact for further processing. On testing the code I found that leaving out the Duplicate() f
Morgan:
This seems to do it:
function sortForm(f) {
var sortArray = arrayNew(2);
var stForm = f;
var keys = structKeyArray(stForm);
var sortedKeys = "";
for (i=1; i LTE #arrayLen(keys)#; i=i+1) {
if (NOT isNumeric(stForm[keys[i]])) {
structDelete(stForm,
le that.
>- Original Message -
>From: "Morgan Senkal" <[EMAIL PROTECTED]>
>To: "CF-Talk" <[EMAIL PROTECTED]>
>Sent: Thursday, May 20, 2004 3:00 PM
>Subject: Re: Sort #FORM# by value?
>
>
>the cfdump I'm getting back for the FORM element:
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
ROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, May 20, 2004 3:00 PM
Subject: Re: Sort #FORM# by value?
> Ok, for starters I tried adding a simple if statement like so:
>
> if (isNumeric(kArray[1]))
> {
> formValueArray[arrayLen(formValueArray)+
Doesn't matter, as long as I can access the name in relation to the value. On second thought, I think the way I coded the form, I don't believe that it is possible for there to be repeat values. (all the form values in question are from checkboxes, so I can control the values sent). So actually
when you say you need to retain the original key name...how so? a 2d array?
a structure?
Charlie
- Original Message -
From: "Morgan Senkal" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Thursday, May 20, 2004 2:56 PM
Subject: Re: Sort
Ok, for starters I tried adding a simple if statement like so:
if (isNumeric(kArray[1]))
{
formValueArray[arrayLen(formValueArray)+1] = stForm[kArray[i]];
}
But apparently it doesn't recognize any of the values as numbers. This is the cfdump I'm getting back for the FORM element:
ACTIONDATE1
I suppose I should have given more information, sorry :-( But to clarify: I only want to pull out FORM values which are numeric and order those. I also need to somehow retain the key name associated to each value. It's a good start tho thanks much Charlie! Perhaps you and I can fiddle with it
Hi Morgan:
Might be a better/more efficient way, but threw together a quick UDF
that seems to work:
function sortForm(stForm) {
var formValueArray = arrayNew(1);
var kArray = structKeyArray(stForm);
for (i=1; i LTE arrayLen(kArray); i=i+1) {
formValueArray[arrayLen(form
9 matches
Mail list logo