I was able to get the listing to display by putting the hidden field outside of the loop. For testing purposes I added a <cfdump var="#form#"> on my action page to see whats
getting passed.

For example.

If I select the below pages:

1,2,3,4,5,6,7,8,9,15,16,17,18,19,25

When I submit the form I get the same output.

1,2,3,4,5,6,7,8,9,15,16,17,18,19,25

What I want to appear is this:

1-9,15-19,25

On Wed, 19 May 2004 17:41:35 +0200, Pascal Peters wrote:

>Rename your select "filelistselect",
>create a hidden field named "filelist"
>and call this JS function in the onsubmit of the form:
>
>function makeList(thisform){
> var opts = thisform.filelistselect.options,
>     val="",
>     i=0;
> for(;i<opts.length;i++){
> if(opts[i].selected){
> if(i==0 || !opts[i-1].selected){
> val += ((val.length>0)?",":"") +
>opts[i].value;
> }
> else if(i==opts.length-1 ||
>!opts[i+1].selected){
> val += "-" + opts[i].value;
> }
> }
> }
> thisform.filelist.value = val;
> thisform.filelistselect.disabled = true;
>}
>
><form ... > >
>Pascal
>
>
>>
>>
>> I need to pass it like  1-16,23-25,30,33,40-42,46-48 to the server.
>>
>> >> <select name="filelist" size="15" multiple class="dirlinks">
>> >>
>> >> <cfloop INDEX="i" FROM="1" TO="#ArrayLen(arPages)#">
>> >>
>> >> <cfset sVal = Trim(ListFirst(arPages[i], ">"))>
>> >>
>> >> <cfset sDisp = Trim(ListLast(arPages[i], ">"))>
>> >>
>> >> <cfset sValNoComma = NumberFormat(sVal, "9999999999")>
>> >>
>> >> <cfset sVal = NumberFormat(sVal)>
>> >>
>> >> <option value="#sValNoComma#">Seq:
>> >> #sValNoComma#&nbsp;&nbsp;Folio: #sDisp##spacer1#</option>
>> >>
>> >> </cfloop>
>> >>
>> >> </select>
>
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to