CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> Archive -> GotoCode Archive

 PHP CCS2.0.5.6 Editable Grid / List Boxes

Print topic Send  topic

Author Message
Lee Irving
Posted: 04/03/2003, 4:11 AM

I am attempting to get the following working within CCS 2.0.5.6

On the page there is an editable grid, each row in the grid has a hidden
field {SlotCode} there is also a list box which searches another table for
the list values. These list values should be the ones associated against the
slotcode.

ie
table - slottoworkshop
Slot Workshop Code Workshop
1 2 Web Workshop
1 3 PHP Coding
1 4 Greek
2 5 Indian Cooking
2 6 French

If slotcode = 1 in the first row then the list box should contain:

WebWorkshop
PHPCoding
Greek

However the next row of the grid has slotcode = 2 and then the list box
should contain:
Indian Cooking
French

I cannot use URL parameters for the slot code may be different for each row.
The contents of the list box must reflect the value of the slotcode field.

I thought that I could pick up the value of SlotCode and use this as a query
parameter somehow. I have tried Form and Application parameter types
however I cant seem to get them to work. Can anyone point me in the right
direction or maybe to documentation explaining the use of Form and
Application parameters withing the SQL where clause.

Regards

Lee
Headhunter
Posted: 04/03/2003, 5:17 AM

In the data source of your listbox, add a Where statement like this:

Field name: "slot"
Field type: "integer"
Condition: "="
Parameter source: "slotcode"
Parameter source type: "Form"

Hope this works.
Lee Irving
Posted: 04/03/2003, 5:28 AM

thanks, however I have already tried this and it does not seem to work.

anyone else have some ideas?

Regards

Lee
Headhunter
Posted: 04/03/2003, 10:56 PM

Offcourse it does not work. Stupid me.

I think you have to add a before show row event to your updatable grid and retrieve value for control. Use that value for your where statement. (I did not test it out, I was just brainstorming).
Karen
Posted: 09/25/2003, 9:31 PM

Hi,

I'm also trying to do the same thing. I've tried retrieving a value in the before show row event and have also tried the other suggestions but still does not work. Has anyone got this working yet?

TIA!

-Karen
stephenk
Posted: 09/26/2003, 12:39 AM

The listbox has a datasource assosiated with it

Assuming bound value set to workshop code, display value set to workshop
In design mode
-query_table slottoworkshop
-add where clause (slot = -1) :this is important or [pathtolistbox]->ds->where does not exist

In before show row event change the where clause
PHP will look like this
$val = $editablegridname->Slotname->GetValue();
$editablegridname->lisbox->ds->where = "slot=$val";
Karen
Posted: 09/26/2003, 1:13 AM

I've tried change the Where clause in many different events and the only place where it works is in the before build select event of the listbox control. But here, I could only get a fixed value to work, not a variable as retrieved from another control. Whenever I tried to assign the value of the control for the where clause, it seems to be null. Could it be that at this point, the controls' values in the rows have not been populated yet, hence no value returned by GetValue()?

Pls help!
stephenk
Posted: 09/26/2003, 1:44 AM

Karen is right you cant change the datasource in that event

Looking through the code it seems that the listboxes are populated in the grid initialise method which happens before the show method where the before show row event is called.

A possible workaround to this is to have the listbox on its own page and reference it through an iframe
[main page]
<iframe src="listboxpage?slotcode={slotcode}&controlname={hiddeninput}">
[end main page]
and use the javascript: onchange event to update a hidden field on the parent page

[iframe page javascript]
//set newval to selected index of listbox
control = eval("window.parent.forms["gridformname"]."+{hiddeninput});
control.value = newval;
[end iframe page]

The javascript might be wrong but you can get the idea.
I dont have time to try this.
Karen
Posted: 09/26/2003, 7:35 AM

Thank you very much for your suggestion, I'll try it and see what happens. At least I know that it's not my code that's broken!
Jafarian
Posted: 10/02/2003, 1:32 AM

Dear LEE,
i have a problem like you. you can see my question at 17/9/2003 in this forum,
i paste it for you again here:
Dynamic RadioButton in EditableGrids ??

i want to build a Test EXAM Page , it contain QUESTIONs and 4 ANSWER for any.
i use Editable grid to get users answers, and use Radio Button to Show Answers for each Question, therefore each row must contain New Answere for New Questions, i write this code in BeforeBuildSelect event to change "WHERE" statment of RadioButton's DataSource, but it works only for first row, i tried BeforeShowRow Event but it did not Affect any thing !
Please Help me.
AnswersID.DataSource.Where = " QuestionID=" & QuestionID.Value

i receive this from "Si. Cranmer" :

I have already done this but sorry cannot find it :-(...
Howevere (please excuse me if the codes not right as I use PHP) but if I remember right its in event <object>_datasource_BEFOREBUILDSELECT

<object>.datasource.sql = "Select...."
<object>.datasource.WHERE = " QuestionID=" & QuestionID.Value <object>.datasource.ORDER = " <field> DESC"

PLease check it, i think it will work, i will test it, and tell you about results.

Bye, N.Jafarian
Jafarian
Posted: 10/05/2003, 12:46 AM

Dear Lee,

it did not work , i test it.
i found that, Before_Build_Select event run once before show_grid event, then
if there is any code to run in Before_Show_Row or Before_Show_ListBox , it will work.

Jafarian

   


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

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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