Small correction for hidden fields

All ApPHP DataGrid script bugs discussion. Questions and requests here.
Please, use a $debug_mode = true; before you say "Why Nothing Works ?!" (solves 90% of all issues)

Moderator: alexandrleonenko

BlackLocust
Senior
Senior
Posts: 34
Joined: Sep 16th, '09, 23:17

Small correction for hidden fields

Postby BlackLocust » Oct 15th, '13, 19:54

In edit mode, hidden fields come up blank if no value or default is specified in the em_cols array. However, if no value or default is specified, they should receive the value loaded from the database. Most of the code seems to intend this, especially as one studies the logic in GetFieldValueByType ... but ... there's an error on line 4053 in version 7.9.9.

$hidden_fields .= $this->GetFieldValueByType('', 0, '', $c_field_name);

should be

$hidden_fields .= $this->GetFieldValueByType($row_c, 0, '', $c_field_name);

Thanks!

Daniel Wilson

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: Small correction for hidden fields

Postby administrator » Oct 16th, '13, 06:47

In edit mode hidden fields use "value"=>"" attribute and in Add Mode only "default"=>"'
so the last is not used in Edit mode at all. Now, if you defined "value"=>"" it means you want to change it to the current "" empty value isn't it?

BlackLocust
Senior
Senior
Posts: 34
Joined: Sep 16th, '09, 23:17

Re: Small correction for hidden fields

Postby BlackLocust » Oct 16th, '13, 14:01

Is there supposed to be a way to get the hidden field to load from the DB in edit mode? I couldn't figure one out w/o the change I made. I need the hidden field to post for some validation.

If my suggested change breaks deliberate functionality, I'll just keep it as one of my customizations.

administrator
Site Admin
Site Admin
Posts: 5997
Joined: Jan 7th, '09, 23:18
Contact:

Re: Small correction for hidden fields

Postby administrator » Oct 17th, '13, 07:13

Sure, just leave empty:

Code: Select all

"default"=>"", "value"=>"",


Example:

Code: Select all

"last_time_updated" =>array("header"=>"Last Time Updated", "type"=>"hidden", "req_type"=>"st", "default"=>"", "value"=>"", ....


in this case the field will take the value from database (in edit mode).


Return to “ApPHP DataGrid {bugs}”