Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Assigning default value to column..to help everyone.

phpMyEdit General     Assigning default value to column..to help everyone.
Odoslať novú tému   Odpovedať na tému    
 
kliklinksteve     Založený: 19.08.2004   Príspevky: 1  
Príspevok Zaslal: 2004-08-19 21:18
Návrat hore  Odpovedať s citátom     

Hi guys
A question for all, that has not been clearly explained... how do I apply a default value to a hidden column such as column=value?

 
n9yty     Založený: 03.10.2004   Príspevky: 2  
Príspevok Zaslal: 2004-10-03 02:29
Návrat hore  Odpovedať s citátom     

I thought this would be easy, but it's proving very difficult... I want a hidden field to be updated automatically based on a PHP variable set in the script before I run the phpMyEdit class...

My 'fdd' looked like this:

$opts['fdd']['location'] = array(
'name' => 'Location Code',
'options' => 'H',
'select' => 'T',
'maxlen' => 3,
'default' => $user_loc
);

The field is always blank in the database for records added. Putting in a `echo` statement in PHP for this web page shows that the variable $user_loc is defined appropriately.

I tried to insert this in to the above, and it didn't help either:

'sqlw' => 'UPPER($user_loc)'

Finally, even doing this didn't help:

$opts['cgi']['overwrite']['location'] = "$user_loc";

I had a similar problem with another field that I used a trigger, which worked, but seemed a lot of extra work for something this simple.

I also think this is related, where I tried to create a dynamic range for a drop-down list to choose the year, starting with the current year as the default:

$temp = getdate();
$opts['fdd']['year'] = array(
'name' => 'Year',
'select' => 'D',
'default' => $temp['year'],
'values' => range(2000, $temp['year']),
'maxlen' => 4,
'required' => true,
'sort' => true,
'js' => array('required' => 'true')
);

However, although the range was right, the default is not set.

Am I missing something obvious? I'm using the latest CVS version of phpMyEdit because I wish to take advantage of some of the new features. Is it possible this is broken in CVS?

Many Thanks! -- Steve

 
michal     Založený: 17.06.2003   Príspevky: 537   Bydlisko: Slovakia
Príspevok Zaslal: 2004-10-04 10:31
Návrat hore  Odpovedať s citátom     

the H flag has wierd behaviour. i needed a hidden field (really hidden, so that the user can't see it, not just <.. type=hidden ...>). i had to use triggers. or try options 'HAC' (AC should make it insert to the db, H should make it hidden).

for your second problem, try "range($temp['year'], 2000)" (recalling back, i cannot remember using range option, so just a guess)

 
n9yty     Založený: 03.10.2004   Príspevky: 2  
Príspevok Zaslal: 2004-10-04 17:48
Návrat hore  Odpovedať s citátom     

michal Napísal:
the H flag has wierd behaviour. i needed a hidden field (really hidden, so that the user can't see it, not just <.. type=hidden ...>). i had to use triggers. or try options 'HAC' (AC should make it insert to the db, H should make it hidden).

I found this by carefully reading more posts in the forum... Also, I have switched to the new(?) method of separating 'options' from 'input'. So I have a field with 'H' in 'input' and 'A' in 'options', and it seems to be working as I would like.

Citácia:
for your second problem, try "range($temp['year'], 2000)" (recalling back, i cannot remember using range option, so just a guess)

The range portion is working as expected, however the default value is not being used to make the default item in the list be the one selected initiially. This is a small problem, so I am not worried about it right now.

Thanks to the development team for an EXCELLENT solution!

 
Odoslať novú tému   Odpovedať na tému    

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