Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing multiple urls on a single page

Status
Not open for further replies.

Newbedude

Programmer
Jun 6, 2003
9
0
0
US
I have a simple Employee list with fields ID and Name.
The index page allows the user to view all of the Employees information. They can then click on edit url link besides each record to change the record on the same page. All changes work off 1 action page. This works fine. I also have a sort feature for the index page that can sort the records by ID or Name for the display part of the index page. this works fine however i can not seem to get the sort to work when im in edit mode. Here is some of the code i have. Any help is appriciated and i thank you in advance.

URL.ID -- is what passes to the Editmode function
ID=#urlEncodedFormat(Trim(ID))#
It is the same code used to pass the id into edit mode and works for that function

Url.sortBy -- uses url to sort the display
Heres what i have that only works in Display for the sort
and how i thought it should work for both

<a href=&quot;index.cfm?<cfif IsDefined(&quot;url.ID&quot;)><cfoutput>ID=#urlEncodedFormat(Trim(ID))#</cfoutput>
<cfelse>?sortBy=ID</cfif><cfif URL.sortBy EQ &quot;ID&quot;><cfif #sort# eq 'ASC'>&sortByType=DESC<cfelse>&sortByType=ASC</cfif>
</cfif>&quot;>ID</a></font></div></td>

The url link should look something like in the browser like
(8 is example of #ID# which can be selected)
index.cfm?ID=8/sortby=ID&sortbyType=DESC
 
My first thought is that you should run your conditional statement outside of the href tag - something like:

<cfif IsDefined(&quot;url.ID&quot;)>
<cfset var1=&quot;ID=#urlEncodedFormat(Trim(url.ID))#&quot;
<cfelse>
<cfset var1=&quot;sortBy=ID&quot;>
</cfif>

<cfif URL.sortBy EQ &quot;ID&quot;>
<cfif sort eq &quot;ASC&quot;>
<cfset var2=&quot;sortByType=DESC&quot;>
<cfelse>
<cfset var2=&quot;sortByType=ASC&quot;>
</cfif>
<cfelse>
<cfset var2=&quot;&quot;>
</cfif>

<a href=&quot;index.cfm?#var1#&#var2#&quot;>ID</a>

My second thought is, what do you mean by &quot; i can not seem to get the sort to work when im in edit mode&quot;? Do you mean that when you click the sort link, you are taken out of edit mode? Or are you getting error messages? Something else?
 
Based on what you wanted the url to look in the browser.
Try the following conditional statement from within the url.

<a href=&quot;index.cfm?<cfif IsDefined(&quot;url.ID&quot;)
?id=#url.id#&
<cfelse>?
</cfif>
<cfif URL.sortBy EQ &quot;ID&quot;>
<cfif URL.sortBy EQ &quot;ID&quot;>
<cfif #sort# eq 'ASC'>&sortByType=DESC<cfelse>&sortByType=ASC</cfif>
</cfif>&quot;>ID</a></font></div></td>

Hope This helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top