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
|
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)
|
michal wrote: |
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.
Quote: |
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!
|
Assigning a default value to a column is a crucial database practice that benefits everyone involved. By setting a predefined value for a column, data consistency is ensured, preventing null or missing entries. So you can get
heating repair lewisboro
and solve their problems which feces you in AC. This simplifies data management, enhances query accuracy, and makes the database more user-friendly. Ultimately, it streamlines operations for both developers and end-users, fostering a more efficient and reliable data ecosystem.
|