Autofill on Date Not Fill-up

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
pelurusilver
User
Posts: 45

Autofill on Date Not Fill-up

Post by pelurusilver »

Hi, I just recently using auto fill the add page using lookup.
I can see the data that I require from the lookup appeared but only the date field not appeared.

i try from date format to date format, text format (dd/mm/yyyy) to date format also not appeared.

is there any special step I need to do first?

this is the target field
DATE_RESIGNED_MEMBERS date DEFAULT NULL


arbei
User
Posts: 9384

Post by arbei »

Dates from the database are in 'yyyy-mm-dd' format, if you use date/time picker, the format is not valid because input data should be in the format of your locale. You can however use the "autofill" event to format the data, e.g. in Startup Script

$("#x_MySourceField").on("autofill", function(e, args) {
    var $target = $(args.target);
    if ($target.data("field") == "x_MyTargetField") { // Check field name
        // Change the args.data
    }
});

pelurusilver
User
Posts: 45

Post by pelurusilver »

if I change the lookup format as TEXT with 'yyyy-mm-dd' format, could it be fillup?


arbei
User
Posts: 9384

Post by arbei »

Note that the setting in View Tag is "yMMdd", the actual date separator is from your locale setting. You can set the "Format Pattern", but is that really what you want? If you change the date format just for auto-fill, the List/View page will show the date in your format pattern, different from your locale setting.


pelurusilver
User
Posts: 45

Post by pelurusilver »

already put at Client Scripts/table-Specific/AddCopy Page

but still not fillup.

my db=koperasi
target field=date_resigned_members
lookup field=date_resigned_members
target table= resign_tracking
lookup table =balance_tracking_tab

what where should I changed?

// Write your table-specific startup script here, no need to add script tags.
$("#x_MySourceField").on("autofill", function(e, balance_tracking_tab) {
    var $target = $(balance_tracking_tab.date_resigned_members1);
    if ($target.date_resigned_members1("date_resigned_members1") == "x_MyTargetField") { // Check field name
        // Change the args.data
    }
});

arbei
User
Posts: 9384

Post by arbei »

pelurusilver wrote:

$("#x_MySourceField").on("autofill", function(e, balance_tracking_tab) { // wrong code, why change "args"?
    var $target = $(balance_tracking_tab.date_resigned_members1); // wrong code, why change?
    if ($target.date_resigned_members1("date_resigned_members1") == "x_MyTargetField") { // wrong code, .data() is a jQuery method, why change?

You also need to replace "x_MySourceField" and "x_MyTargetField" by the real ids of your fields. If you are not sure, inspect HTML Element.

Make sure you understand before you modify. Compare your code with the example carefully.


pelurusilver
User
Posts: 45

Post by pelurusilver »

$("#date_resigned_members1").on("autofill", function(e, args) {
    var $target = $(args.target);
    if ($target.data("field") == "date_resigned_members1") { // Check field name
        // Change the args.data
    }
});

still no luck

there is no "args.data" to be changed. I can't see. Only "args.target"

i dont know how to use elements inspect.

can someone help me?


Post Reply