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
|
 |
 |
mrachow
Posts: 509
|
| Posted: 09/19/2005, 11:59 PM |
|
The name of that parameter is s_year "only".
_________________
Best regards,
Michael |
 |
 |
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
|
 |
 |
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 |
 |
 |
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
|
 |
 |
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 |
 |
 |
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 |
 |
 |
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
|
 |
 |