CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Preserve control values

Print topic Send  topic

Author Message
Karen
Posted: 08/29/2003, 1:00 AM

I'm not sure how to classify my problem so I'll describe what I've done and how I would like the page to behave.

I have 2 includable pages (I'm not sure if it is an include page problem but I'm just describing my situation), one is to set the country selection and another is a search form. These 2 pages are included in a display grid which depends on the selection criteria of the 2 includables. The country selection also sets a session variable which will be used in other pages later.

Here's the problem. The submit buttons of each of the includables will reset the selection of the other. So, let's say I've selected country to be US and then I proceed to perform the search. My country selection goes back to original. I don't understand why the session variable does not get maintained either. I'm not really sure what's happening.

Here's how I would like it to be. The country selection should be set as a session variable and gets display in the country selection form. It should not change unless the user sets another country. Similarly the search results submission should not be affected by country selection.

I hope someone can understand this and offer me some help. TIA!
Karen
Posted: 08/29/2003, 1:14 AM

Sorry, forgot to mention that I'm using CCS with PHP/MySQL.
RonB
Posted: 08/29/2003, 4:19 AM

I'm not sure if I understand what you mean. Why use includable pages for this? Couldn't you just set these forms on one page?

- session variable. A session variable has to be processed first so you'll have to do an event that takes the country parameter from the url and transforms it into a session variable. Something like a beforeshow event:

if(CCGetParam("control_name","") !="")
{
CCSetSession("country","");
}

In the next form I assume you have a dropdown with country names. Click on the dropdown and in toolbox click on DataSource. Add a parameter to the query (country) and set it's source to session.

That should do the trick.

Ron
RonB
Posted: 08/29/2003, 4:40 AM

Sorry, should be

if(CCGetParam("control_name","") !="")
{
CCSetSession("country",CCGetParam("control_name","");
}

Ron
Karen
Posted: 08/29/2003, 8:29 AM

Hi Ron,

Thanx very much for trying to understand my problem.

I used includable pages becoz these forms will also appear on other pages so I thought that would eliminate duplicate (or more) work, everytime I need the same forms on the other pages.

I have actually managed to save the session variable by adding the 'Save Control Value' action to the 'Server On Click' event of the button (set country form). However, this somehow gets reset when I click submit on the search form. It's becoz some values are submitted and the whole page gets reloaded.

Perhaps I should explain the effect that I'm trying to create. It is a display grid with products as a result of the search parameters. However, the prices for these products will vary depending on country. The user would normally set the country once but search more than once, which explains why I didn't want to include the country selection into the search.

If the user clicks into a product, the details of the product will be displayed. And in this page, the user still has an option to set the country again (in case they made a mistake) and of course, do another search. Basically the set country and search forms can appear in a variety of places.

I'm open to the idea of doing this some other way but at the moment, I'm not sure how to. Has anyone got any ideas or have done this before?

TIA!
RonB
Posted: 08/29/2003, 9:36 AM

The save value is probably the problem. If the value is empty(i.e. everytime the page opens before a country is selected) the session variable is being replaced with the empty value. To prefend this you have to find a way of filling the control value with the existing session value before the page recognizes the empty control value and replaces the existing session value with the empty value.

The event code I gave you therefore first checks if the session value is empty and then proceeds to fill the session variable with the value transmitted through the url.

I think setting a parameter for the query that get's the country list with session as source would solve the problem. The session value would still be written every time the page is opened but the controll would be filled with any existing session value so that would no longer be a problem.

Ron

Karen
Posted: 08/29/2003, 8:36 PM

Hi Ron,

I've tried setting the datasource for the country but still the same. Thanx for your suggestions.

I think I'll change my design for now until I find a solution to this.

If anyone has done something similar successfully, pls let me know. Thanx so much!

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.