CodeCharge Studio
search Register Login  

Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Change value of input before building query string

Print topic Send  topic

Author Message
robeh

Posts: 17
Posted: 09/19/2005, 4:13 PM

I have a simple search screen, and one of the parameters is a listbox of years. Once the user selects a year, and hits submit, I need to change the value of the selected year (specifically, divide it by 100) before the query string is built. How should I do this? My best guess so far is this code
$cyear = CCGetParam("$simpleSearch->s_year", "");
$simpleSearch->s_year->SetValue(floor($cyear/100));
in BeforeBuildSelect, but this has failed. What am I doing wrong?
Thanks from a new user still trying to learn this.

Robert
View profile  Send private message
mrachow


Posts: 509
Posted: 09/19/2005, 11:59 PM

The name of that parameter is s_year "only".
_________________
Best regards,
Michael
View profile  Send private message
robeh

Posts: 17
Posted: 09/20/2005, 12:47 AM

I don't understand this - $simpleSearch is the name of the grid. If I take that out, the page doesn't display at all. Or are you referring to something else?

Robert
View profile  Send private message
feha


Posts: 712
Posted: 09/20/2005, 1:25 AM

Hi robeh

Your
$cyear = CCGetParam("$simpleSearch->s_year", "");
is wrong, should be:
$cyear = CCGetParam("s_year", "");


_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
robeh

Posts: 17
Posted: 09/20/2005, 11:29 AM

Ok, I got that far - I got $cyear to equal what it should. I can even set
$cyear = floor($cyear/100) and get that to equal what it should.
But the SetValue statement is wrong and I have no idea why. If I have the
statement in there at all, the page doesn't display. Even if I take out the
$simpleSearch part. So how do I get
$simpleSearch->s_year to equal $cyear if I can't use SetValue here? Or if
I can, what is the proper syntax?

Robert
View profile  Send private message
feha


Posts: 712
Posted: 09/20/2005, 1:08 PM

OK
They way you are trying is wrong cause is sets the value of your search form after you submit.

if you resubmit it will "devide" the value once more etc ...

You need to change this value in before show record grid not within search form.

I can't answer cause i don't know how it looks your select statement !?

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
feha


Posts: 712
Posted: 09/20/2005, 1:13 PM

sorry, before build select

example:
  
$cyear = floor($cyear/100)  
$SQL="SLECT * ........ WHERE this=".$cyear .";   

_________________
Regards
feha

www.vision.to
feedpixel.com
View profile  Send private message
robeh

Posts: 17
Posted: 09/20/2005, 3:04 PM

ok - almost solved -
I took out clientside code, and added the following javascript code to the html:
  
var sel = document.simpleSearch.s_year.value;  
 sel = parseInt(sel/100);  
 document.simpleSearch.s_year.value = sel;  

Now the search works in the CodeCharge browser (but for some reason the
s_year parameter is not displayed in the url in the search results) and in
Internet Explorer, but it does not work in Firefox (and I do have javascript turned on). Any ideas why?

And I still don't quite understand why it doesn't work to do this in php on
server side - can anyone explain?

Thanks.

Robert
View profile  Send private message

Add new topic Subscribe to topic   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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