Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 14. september 2024
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Adding a Drop-Down Box to fields in the EDIT or ADD PAGE

phpMyEdit Configuration     Adding a Drop-Down Box to fields in the EDIT or ADD PAGE
Odoslať novú tému   Odpovedať na tému   Choď na stránku 1, 2, 3  Ďalší  
 
jz     Založený: 31.01.2003   Príspevky: 6  
Príspevok Zaslal: 2003-01-31 19:00
Návrat hore  Odpovedať s citátom     

I just downloaded and installed phpMyEdit v.5.2 and all seems to be working well. My question is: Is it possible to add a drop-down box to edit or add data while editing a record. I have been able to make the drop-down work on the main listing page following the directions at http://phymyedit.sourceforge.net/lookups.html and your answer to Rober Cohen on the other Maillist where you wrote:
"Re: curiosity... about values found in the specified column of another table
2003-01-14 15:53
> $opts['fdd']['codcity'] = array(
> 'name'=>'Codcity',
> 'select'=>'T',
> 'type'=>'int',
> 'maxlen'=>6,
> 'nowrap'=>false,
> 'required'=>true,
> 'default'=>'0',
> 'sort'=>true
> );
> $fdd['codcity']['values']['table'] = 'city';
> $fdd['codcity']['values']['column'] = 'code';
> $fdd['codcity']['values']['description'] = 'name';

Write

$opts['fdd'] = $fdd;

at the end of your field declarations or use $opts['fdd'] instead of $fdd
for fields definitions. So in your case it should looks like this:

$opts['fdd']['codcity']['values']['table'] = 'city';
$opts['fdd']['codcity']['values']['column'] = 'code';
$opts['fdd']['codcity']['values']['description'] = 'name';"

but this does not give me a drop-down on the edit page. Is there a way to do this.
Thanks for any help you can give.
Julian

 
nepto     Založený: 06.01.2003   Príspevky: 381   Bydlisko: Phoenix, Arizona (USA)
Príspevok Zaslal: 2003-02-01 03:20
Návrat hore  Odpovedať s citátom     

jz Napísal:
... I have been able to make the drop-down work on the main listing page following the directions ... but this does not give me a drop-down on the edit page.


So if I understand that correctly, you were able to make drop-down work on the table listing with filter, but not on the edit page. How about add or copy page? I assume, that there it did not work too.

Can you post here definition of particular field, which should be drop-down and it does not work?

 
jz     Založený: 31.01.2003   Príspevky: 6  
Príspevok Zaslal: 2003-02-03 15:20
Návrat hore  Odpovedať s citátom     

nepto Napísal:
jz Napísal:
... I have been able to make the drop-down work on the main listing page following the directions ... but this does not give me a drop-down on the edit page.


So if I understand that correctly, you were able to make drop-down work on the table listing with filter, but not on the edit page. How about add or copy page? I assume, that there it did not work too.

Can you post here definition of particular field, which should be drop-down and which does not work?


You are correct the drop-down did not work on the edit or add page. I am not sure which listing is the "filter" listing - is it the first or main page that appears? what below I call the "main" page?

The code for that particular field is:
$opts['fdd']['PROVRELCD'] = array(
'name'=>'PROVRELCD',
'select'=>'D',
//<--changed to create drop-down
'type'=>'string',
'maxlen'=>3,
'nowrap'=>false,
'required'=>false,
'sort'=>true
);


$fdd['PROVRELCD']['values']['table'] = 'provinces';
$fdd['PROVRELCD']['values']['column'] = 'provrelcd';
$fdd['PROVRELCD']['values']['description'] = 'provrelnm';
$opts['fdd'] = $fdd;


( 1) My first question: It was suggested to add the part I've listed in boldface to create the drop-down box. This does give me a a drop-down box at that point but truncates all the pages i.e. at the point where the drop-down appears on the ADD - EDIT pages - the 5 or 6 fields prior to this field are NOT DISPLAYED AT ALL! This is true also on the main page. But this is not what I want. What code has to be added to get a drop-down for those fields where I have changed 'select'=>'D' to "D" and want to use data from another database to fill that field?

(2) My second question: how can the drop-down on the main page be used ? that I noticed appears when I changed the above code in italics which was my original code and which did not give me any drop-downs on the ADD or EDIT pages but did give me drop-down on all fields on the MAIN page where I changed the "select option" to "D" e.g. 'select'=>'D' . Is it just a listing of the data in that field?

 
nepto     Založený: 06.01.2003   Príspevky: 381   Bydlisko: Phoenix, Arizona (USA)
Príspevok Zaslal: 2003-02-03 22:55
Návrat hore  Odpovedať s citátom     

Yeah, I see the problem. You use firstly $opts['fdd']['PROVRELCD'] , than you use $fdd['PROVRELCD']... with $opts['fdd'] = $fdd; . Please realize, that using the last command you completelly overwrite whole $opts['fdd'] array.

Thus you need to correct all $opts['fdd']['something'] to $fdd['something'] or all $fdd['PROVRELCD'] to $opts['fdd']['PROVRELCD'] .

I strongly recommend you to use the second approach, since it is compatible with generated code. However, the first one should also works.

 
nepto     Založený: 06.01.2003   Príspevky: 381   Bydlisko: Phoenix, Arizona (USA)
Príspevok Zaslal: 2003-02-03 23:03
Návrat hore  Odpovedať s citátom     

Two more things I want to mention...

I must admit, that this state is confused. It is because the initialization style or better say initialization approach was changed. I want to remove $fdd completely and use $opts['fdd'] only. In further version generated code will be in sync with examples in code comments.

The already written documentation (which will appear in comming 5.3 release) uses in its examples only $opts['fdd'] initialization approach. However, there is also one special section, where is this issue of two initialization approaches described more deeply with focus on problems it can bring.

Hoping the previous post will help you. If not, just ask again.

 
jz     Založený: 31.01.2003   Príspevky: 6  
Príspevok Zaslal: 2003-02-04 12:40
Návrat hore  Odpovedať s citátom     

nepto Napísal:

Hoping the previous post will help you. If not, just ask again.


I have copied the code below (hopefully correctly as you suggested) -- first one way and then the second way you suggested but both gave me a "Fatal error: Maximum execution time of 30 seconds exceeded". I tried it various ways but it always timed out. If the code is correct is there a way of overriding the error?

(B) below is the code that finally worked with one drop-down box but if I add a second I get the "Fatal error: Maximum execution time of 30 seconds exceeded" (See below (B))

(A)

$opts['fdd']['PROVRELCD'] = array(
'name'=>'PROVRELCD',
'select'=>'D',
'type'=>'string',
'maxlen'=>3,
'nowrap'=>false,
'required'=>false,
'sort'=>true
);

Your suggestion #1: $fdd['provrelcd']['values']['table'] = 'provinces';
$fdd['provrelcd']['values']['column'] = 'provrelcd';
$fdd['provrelcd']['values']['description'] = 'provrelnm';

$fdd['values']['table']='provinces';
$fdd['values']['column']='provrelcd';
$fdd['values']['description']['columns']['1']='provrelcd';
$fdd['values']['description']['divs']['1'] =': ';
$fdd['values']['description']['columns']['2']='provrelnm';

Which gave me this error message:
"Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/ofmconv/phpMyEdit/phpMyEdit.class.php on line 2105"


Your suggestion #2: $opts['fdd']['provrelcd']['values']['table'] = 'provinces';
$opts['fdd']['provrelcd']['values']['column'] = 'provrelcd';
$opts['fdd']['provrelcd']['values']['description'] = 'provrelnm';

$opts['fdd']['values']['table']='provinces';
$opts['fdd']['values']['column']='provrelcd';
$opts['fdd']['values']['description']['columns']['1']='provrelcd';
$opts['fdd']['values']['description']['divs']['1'] =': ';
$opts['fdd']['values']['description']['columns']['2']='provrelnm';
$opts['fdd']['values']['orderby']='provrelnm';

Which gave me this error message:
"Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/xxxxx/phpMyEdit/phpMyEdit.class.php on line 678"


-------------------------------------
(B)
The following works for one drop-down box, if I add more than one I get the "Fatal error: Maximum execution time of 30 seconds exceeded". Why?

One field 'provrelcd' of a table called 'MEMBERS' where I want a drop-down box (utilizing values from another table: 'provinces' with fields or columns 'provrelcd', 'provrelnm', 'provrelit', 'provrelen' that I want to use to update fields in table 'MEMBERS' with fields named: 'provrelcd', 'provrelnm', 'provit', 'proven'


$opts['fdd']['PROVRELCD'] = array(
'name'=>'PROVRELCD',
'select'=>'D',
'type'=>'string',
'maxlen'=>3,
'nowrap'=>false,
'required'=>false,
'sort'=>true
);

$opts['fdd']['provrelcd']['values']['table'] = 'provinces';
$opts['fdd']['provrelcd']['values']['column'] = 'provrelcd';
$opts['fdd']['provrelcd']['values']['description'] = 'provrelnm';

$fdd['values']['table']='provinces';
$fdd['values']['column']='provrelcd';
$fdd['values']['description']['columns']['1']='provrelcd';
$fdd['values']['description']['divs']['1'] =': ';
$fdd['values']['description']['columns']['2']='provrelnm';

<-- from here on I am not sure how to use this. What I would like to do is update the fields in 'MEMBERS' with the values from table 'PROVINCES'. How do I do it? -->

$fdd['values']['description']['divs']['2'] =': ';
$fdd['values']['description']['columns']['3']='provit';
$fdd['values']['description']['divs']['3'] =': ';
$fdd['values']['description']['columns']['4']='proven';
$fdd['values']['description']['divs']['4'] =': ';
$fdd['values']['description']['columns']['5']='proven';
/* ['values']['filters']='idcolumn in (1,2,3)' *optional WHERE clause* */ <-- I am not sure how to use this???
$fdd['values']['orderby']='provrelnm';
/* *optional ORDER BY clause* */

----------------------------------------
JZ

 
nepto     Založený: 06.01.2003   Príspevky: 381   Bydlisko: Phoenix, Arizona (USA)
Príspevok Zaslal: 2003-02-04 22:57
Návrat hore  Odpovedať s citátom     

No, you should use $opts['fdd']['FIELD_NAME_HERE']['values']['table']='provinces'; not $opts['fdd']['values']['table']='provinces'; . Change other fields accordingly.

 
jz     Založený: 31.01.2003   Príspevky: 6  
Príspevok Zaslal: 2003-02-07 12:08
Návrat hore  Odpovedať s citátom     

nepto Napísal:
No, you should use $opts['fdd']['FIELD_NAME_HERE']['values']['table']='provinces'; not $opts['fdd']['values']['table']='provinces'; . Change other fields accordingly.


I have tried making the above changes but am still not getting what I would like to have, i.e. an EDIT page with certain fields with drop-down boxes with selection values listed from another table of data so that I can choose the info I want to complete the field.

The following code has given what I want ....
$opts['fdd']['PROVRELCD'] = array(
'name'=>'PROVRELCD',
'select'=>'D',
'type'=>'string',
'maxlen'=>3,
'nowrap'=>false,
'required'=>false,
'sort'=>true
);

$opts['fdd']['provrelcd']['values']['table'] = 'provinces';
$opts['fdd']['provrelcd']['values']['column'] = 'provrelcd';
$opts['fdd']['provrelcd']['values']['description'] = 'provrelnm';

$fdd['values']['table']='provinces';
$fdd['values']['column']='provrelcd';
$fdd['values']['description']['columns']['1']='provrelcd';
$fdd['values']['description']['divs']['1'] =': ';
$fdd['values']['description']['columns']['2']='provrelnm';

/* ['values']['filters']='idcolumn in (1,2,3)' *optional WHERE clause* */
$fdd['values']['orderby']='proven';

the only problem is that if I set up more than two fields in this way I get a "Timing-Out Error" e.g. " Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/xxxxx/phpMyEdit/phpMyEdit.class.php on line 2032 "

Is there some way of over-riding this error? or resolving the problem in some other way?

jz

 
nepto     Založený: 06.01.2003   Príspevky: 381   Bydlisko: Phoenix, Arizona (USA)
Príspevok Zaslal: 2003-02-07 15:22
Návrat hore  Odpovedať s citátom     

I wonder you still use $fdd initialization, even in bad form (these should be $fdd['provrelcd']['values'] not $fdd['values'] ). Please, remove all $fdd completelly, with $opts['fdd'] = $fdd; command too. Also do not mix PROVRELCD with provrelcd , since that are two completelly different keys.

 
nepto     Založený: 06.01.2003   Príspevky: 381   Bydlisko: Phoenix, Arizona (USA)
Príspevok Zaslal: 2003-02-20 03:39
Návrat hore  Odpovedať s citátom     

Actually, this initialization is good. I do not know what is the issue. I will try to reproduce a problem. However, if the database for the lookup table is the same as for the main table, try to remove ['db'] line.

 
nepto     Založený: 06.01.2003   Príspevky: 381   Bydlisko: Phoenix, Arizona (USA)
Príspevok Zaslal: 2003-02-24 15:38
Návrat hore  Odpovedať s citátom     

Try to remove 'type'=>'string' .

I have only a tiny idea what does this do. It was estabilished and implemented by Jim and I do not know what was his aim of it.

I have to re-think its usage. I'm considering its removal completelly.

 
CharlieArian     Založený: 16.04.2022   Príspevky: 1  
Príspevok Zaslal: 2022-04-16 20:04
Návrat hore  Odpovedať s citátom     

I have absolutely no idea how to add a drop down box. Even though I work for the best uk essay writing services and use computers all day long, I have no idea how to carry out this process. Does that make me computer illiterate?

 
julieduke     Založený: 26.04.2022   Príspevky: 1  
Príspevok Zaslal: 2022-04-26 19:22
Návrat hore  Odpovedať s citátom     

our DNP project will reflect your area of interest, allowing you to engage deeply and create a project focused on clinical practice dnp capstone project writers https://place-4-papers.com/dnp-capstone-project-writers/

 
laakea     Založený: 20.04.2021   Príspevky: 1164  
Príspevok Zaslal: 2023-12-05 10:40
Návrat hore  Odpovedať s citátom     

Genuinely I just read through it again yesteryear and yet We numerous head to fix it and today I wanted to study it again ever again considering that it is somewhat well written. online betting

 
seodon     Založený: 23.08.2023   Príspevky: 689  
Príspevok Zaslal: 2023-12-06 09:00
Návrat hore  Odpovedať s citátom     

Beneficial Write-up, My business is an enormous believer with placing reviews with web-sites to help allow blog site internet writers are aware that theyâ&#8364;&#8482;ve added in anything effective to help online! Kuliah gratis di Universitas Budi Luhur

 
Odoslať novú tému   Odpovedať na tému   Choď na stránku 1, 2, 3  Ďalší  

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov