How can I have 'Full Name' ($memberInfo['custom'][0]) inserted into a text box once user loads the detailed view of a table? I added that to (_before_insert) function but it doesn't actually display it until user clicks save. I think it should be added to (_init) or (_dv) function but not sure how..
It would be great if the function can check if field is empty before inserting the 'Full Name' so it won't insert it if it has data.
Appreciate your help with that
Insert full name into a textbox for table's detail view!
-
- Posts: 9
- Joined: 2016-08-22 04:18
Re: Insert full name into a textbox for table's detail view!
Hi,
it's a bit complicated because in _dv hook you don't have any $data-array for populating intitial values. You can try this in your hook-file. Replace TABLENAME by your table name.
Kind regards,
Jan
it's a bit complicated because in _dv hook you don't have any $data-array for populating intitial values. You can try this in your hook-file. Replace TABLENAME by your table name.
Code: Select all
// file: hooks/TABLENAME.php
// ...
function TABLENAME_dv($selectedID, $memberInfo, &$html, &$args) {
if (!$selectedID) {
$fieldname = "label"; // <-- your fieldname here
$html .= '<script>$j(function(){$j("#'.$fieldname.'").val("'.$memberInfo["custom"][0].'");});</script>';
}
}
// ...
Kind regards,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
-
- Posts: 9
- Joined: 2016-08-22 04:18
Re: Insert full name into a textbox for table's detail view!
Thank you very much Jan. That worked perfectly!
Re: Insert full name into a textbox for table's detail view!
Great, I'm glad to hear that it works!
Best,
Jan
Best,
Jan
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
Re: Insert full name into a textbox for table's detail view!
Good morning,
if anyone else is interested in this: I have written a step-by-step tutorial on changing default values in insert-mode.
There are two parts:
Regards,
Jan
Code
Result
if anyone else is interested in this: I have written a step-by-step tutorial on changing default values in insert-mode.
There are two parts:
- Part 1: Technique + Changing single fields
In Part 1 I am explaining the technique itself and showing how to change a single field
https://appgini.bizzworxx.de/appgini/ho ... ty-part-1/ - Part 2: Changing multiple fields at once
In Part 2 I am showing how to change multiple fields at once with only little code
https://appgini.bizzworxx.de/appgini/ho ... ty-part-2/
Regards,
Jan
Code
Code: Select all
function contacts_dv($selectedID, $memberInfo, &$html, &$args)
{
if (!$selectedID) {
$init_data = [
"label" => $memberInfo["custom"][0],
"last_name" => "Io",
"first_name" => "Europa",
"middle_names" => "Ganymed",
"memberID" => $memberInfo["username"]
];
$html .= '<script>' . implode("\r\n", array_map(function($fieldname, $value) { return "jQuery('#{$fieldname}').val('{$value}');"; }, array_keys($init_data), $init_data )) . '</script>';
}
}
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools