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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

URL Variable Won't Update/No Page Refresh On User's Click

Status
Not open for further replies.

scripter73

Programmer
Joined
Apr 18, 2001
Messages
421
Location
US
I have a form that's displays text and links to a user. The links are: Date/
Insured
. These also represent sort types I'm implementing.

Two things happen when user clicks on a link.
1) the same page is called
2) the form is submitted

When the form's displayed, I initialize #url.sorttype# to "insured" because the referring
page doesn't send my form anything in the url, and I need a default.

I want the following functionality:

Date Insured

On page load, user sees:


Sort Type = insured
Date Insured


When user clicks on Date link, I want to see:


Sort Type = date
Date Insured


Likewise, when user clicks on Insured, I want to see:


Sort Type = insured
Date Insured


I was passing the value 'date' or 'insured back through the url on page refresh and I
have a session var called session.sort_type to hold the value, but my problem is
that the session var isn't being updated and my page isn't refreshing properly.

I don't know what's wrong or if its my action="this(form)" attribute.

Please help. This is just a shell of a much bigger program, and I've been trying
to solve this issue for about a week. I guess I need another pair of eyes.

Here's my code if you'd like to see:

<html>
<head>
<title>Custom Tag Usage</title>
</head>

<body>

<form name=&quot;sortform&quot; action=&quot;this(form)&quot; method=&quot;get&quot; onsubmit=&quot;document.sortform.refresh();&quot;>
<CFPARAM Name=&quot;SESSION.SORT_TYPE&quot; Default=&quot;INSURED&quot;>
<cfif IsDefined(&quot;url.sorttype&quot;) eq &quot;FALSE&quot;>
<cfset #url.sorttype# = &quot;insured&quot;>
</cfif>
<CFSET SESSION.SORT_TYPE = #url.sorttype#>


<CFIF #url.sorttype# eq &quot;insured&quot;>
<cfoutput>Sort Type = #url.sorttype#</cfoutput><br>
Sort Type Insured<br>
<CFELSEIF #url.sorttype# EQ &quot;date&quot;>
<cfoutput>Sort Type = #url.sorttype#</cfoutput><br>
Sort Type Insured<br>
</CFIF>
<A HREF=&quot;sweep.cfm&quot; onclick=&quot;document.sortform.sorttype.value='date';document.sortform.submit();&quot;>Date</A>
<A HREF=&quot;sweep.cfm&quot; onclick=&quot;document.sortform.sorttype.value='insured';document.sortform.submit();&quot;>Insured</A>
<input type=&quot;hidden&quot; name=&quot;sorttype&quot; value=&quot;&quot;>
</form>
</body>
</html>


You can see the link in action by going to

Click On Sweep Bank link, and you'll see what I mean.

Any help you can provide is appreciated.

Thanks,
scripter73

Change Your Thinking, Change Your Life.
 
Not sure if this is what you want but you can pass the values on the url like this:

<a href=&quot;sweep.cfm?sortType=date&quot; >date</a>
<a href=&quot;sweep.cfm?sortType=insured&quot; >date</a>

For this you dont need a form to pass the values the above links should point back to the same page in the page you should have :

<cfif URL.sortType EQ &quot;date&quot; >
sort type = date
<cfelse>
sort type = insured
<cfif>

OR even

<cfoutput>sort type = #URL.sortType#</cfoutput>

At the top of the page use the cfparam to set the default when they first hit the page:

<cfparam name=&quot;URL.sortType&quot; default=&quot;date&quot; >

HTH

Kola
 
Thanks,

That worked.

I appreciate all of your help.

scripter73
Change Your Thinking, Change Your Life.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top