PHP Classes

Wizard

Recommend this page to a friend!

      N-Tier Client side Cascading select  >  All threads  >  Wizard  >  (Un) Subscribe thread alerts  
Subject:Wizard
Summary:Wizard Compat
Messages:11
Author:Dean Mumby
Date:2005-06-08 15:32:37
Update:2005-08-04 09:34:05
 
  1 - 10   11 - 11  

  1. Wizard   Reply   Report abuse  
Picture of Dean Mumby Dean Mumby - 2005-06-08 15:32:37
Hi dave

Great to see this new class. I will have a look a.s.a.p. I am curious though whether you are any closer to incorporating this into your wizard class.

Regards
Dean

  2. Re: Wizard   Reply   Report abuse  
Picture of Dave Dave - 2005-06-13 07:27:07 - In reply to message 1 from Dean Mumby
Hiya Dean

Techincally, it could be incorportated right now, since the wizard class has the facility to allow custom html fields to be placed on the wizard. But I think I know where you're going with this -- you would like proper integration with the wizard class.

Don't fear -- I will certainly incorporate it. In fact, one of the main driving factors (apart from the pure desire to solve the problem) was the request for the functionality in the wizard class.

I'll update on the wizard class page as soon as I have integration working.

-d

  3. Re: Wizard   Reply   Report abuse  
Picture of Dean Mumby Dean Mumby - 2005-06-13 08:12:24 - In reply to message 2 from Dave
Great Dave

I am looking forward to that release.

Cheers
Dean

  4. Re: Wizard   Reply   Report abuse  
Picture of Dean Mumby Dean Mumby - 2005-08-02 12:53:00 - In reply to message 3 from Dean Mumby
Hi Dave

I have finally had an opportunity to look at the new wizard and cassel classes. I can see how the cassel works. But I guess in order to use this with a mysql db I will have to create all possible arrays before creating the wizard / cassel element. Do you have any guidelines on what format / method should be used to create the arrays ?

Dean

  5. Re: Wizard   Reply   Report abuse  
Picture of Dave Dave - 2005-08-02 14:07:37 - In reply to message 4 from Dean Mumby
well, since cassel uses an associative array of option values against new lists of option name/value pairs for each child select object, I would suggest that you store the data in a format that makes sense with that paradigm; perhaps something like:

table: countries
id name
1 america
2 england
3 south africa

table: languages
id country language
1 1 american english
2 1 spanish
3 1 american indian
4 2 real english
5 2 cockney english
6 2 german
7 3 real english
8 3 afrikaans
9 3 sotho
10 3 zulu
11 3 tswana

(the above is very obviously a spoof (: )
but I think you get the idea. When you do a lookup, you will select from the countrys table, left joining on the languages table (and so on, for other dependencies) and have a function that iterates through all returned rows to build the php associative arrays of name/value pairs. The example given is rather simplistic, I know, but I hope that gives a general idea? Where you have a many-to-one mapping, you would have to reflect that in your data, like language id's 4 and 7.

Does this help at all?

  6. Re: Wizard   Reply   Report abuse  
Picture of Dave Dave - 2005-08-02 14:27:46 - In reply to message 4 from Dean Mumby
I also forgot to mention -- I'm actively using the wizard class now in development as well (I kinda had to put usage and development on a back burner to work on the middleware stuff that the php class will be handling client interfaces for), so there is a lot happening in the Wizard world these days. Please keep an eye out for updates -- even today, I've implemented a couple of bugfixes, and a new input type. Just recently I have also employed a more robust javascript event handling model (brought about by looking at someone else's code and figuring out a more generic solution) which will allow not only for more interactive pages, but easier development for the client programmer. I should be uploading Real Soon Now (tm) -- hopefully you can get a version that's not broken within about 30 minutes... Though I'm not sure if there is any latency between when I do file updates and when the file is available from phpclasses.net, especially considering the whole mirroring thing.

-d

  7. Re: Wizard   Reply   Report abuse  
Picture of Dean Mumby Dean Mumby - 2005-08-02 18:35:54 - In reply to message 6 from Dave
Hi Dave

Thanks for the help. I do have tables the way you suggest and was able to figure out how to create the arrays in a way that would work with this class.
(Spent a bit of time on php.net reading about arrays again.) Any way I managed to get it right . Here is code that is working for me , may help someone else.

$cou_reg = array();
$sql = "select id , name from countries order by name ;";
$db->speak($sql);
while ($data=$db->listen()){
$cou_id = $data['id'];
$cou_name = $data['name'];
$regs = array(); // create array
$sql1 = "select id , name from regions where countryid=$cou_id order by name ;";
$db1->speak($sql1);
while ($data1=$db1->listen()){
$reg_id = $data1['id'];
$reg_name = $data1['name'];
$regs[$reg_id] = $reg_name;
}
$regionarray = array('co_region' => $regs );
$cou_reg[$cou_id] = array($cou_name => $regionarray);
}

I then have this in in the wizard page to use this array

$def=array(
"step" => $stepnum,
"prompt" => "Company Country :",
"type" => "cassel",
"varname" => "co_country",
"value" => "$co_country",
"cascades" => $cou_reg ,

);
$w->addinput($def);
$def=array(
"step" => $stepnum,
"prompt" => "Company Region :",
"type" => "cassel",
"varname" => "co_region",
"value" => "$co_region",

);
$w->addinput($def);

It works fine when you just run the wizard. But i have almost an exact copy of the page for editing the data and I populate the variables from a db query , this also works fine for the first select box (ie the country) but not for the sub_select (ie the region). I read through the cassel docs and it refers to sel_idx and sel_val but none of them seem to make any difference.

Am I missing something simple here ?

Regards
Dean


  8. Re: Wizard   Reply   Report abuse  
Picture of Dave Dave - 2005-08-03 09:22:51 - In reply to message 7 from Dean Mumby
Let me just get this totally right: are both selects not being set to the correct value on an edit, or just the child select? Because I have a feeling that the child select may not be being set, but the parent should be set correctly.

  9. Re: Wizard   Reply   Report abuse  
Picture of Dean Mumby Dean Mumby - 2005-08-03 17:14:56 - In reply to message 8 from Dave
only the child select is not being set

Regards
Dean

  10. Re: Wizard   Reply   Report abuse  
Picture of Dave Dave - 2005-08-04 07:59:05 - In reply to message 9 from Dean Mumby
I thought that might be the problem (:

there is a way you can deal with that now -- I added support for a child select to have a default value when it's list is set by the parent -- check out the latest version of cassel -- I've even documented it (which is rare these days).

So you could set the default value for the child for the list that is originally loaded to be that which you pulled up out of the database.

 
  1 - 10   11 - 11