Page 1 of 1

Problem with auto-fill

Posted: Fri Aug 16, 2013 2:53 pm
by digitalphotoworld

I have set up a table with auto-fill. The filling of the fields works great, with one exception: The field price is field with a value like 12.5 and not 12,5, this results in an error. At the moment it is necessary to change the auto-fill values from . to , by hand.

My locale settings are german with , for decimal and . for thousends separator.


Re: Problem with auto-fill

Posted: Fri Aug 16, 2013 3:27 pm
by Webmaster

AutoFill just place the source field value returned by the database to the target field directly, if you need to format it, use Start Script (see Server Events and Client Scripts in the help file) to subscribe the "autofill" event, e.g. (v10)

$("#x_YourSourceField").on("autofill", function(e, args) {
//alert(args.data); // view the value
args.data = "Your Formatted Value"; // change the value
});

Make sure you change $("#x_YourSourceField") to your field's name. The code also assumes you are working in the Add/Edit page.


Re: Problem with auto-fill

Posted: Fri Aug 16, 2013 5:29 pm
by digitalphotoworld

Now in Addpage it works like a charm.

If someone has the the same problem, he could use this code:

$("#x_YourSourceField").on("autofill", function(e, args) {
//alert(args.data); // view the value
args.data = args.data.replace( /\./ , "," ); // change the value
});

Attention: This code replace the . to , for EACH autofill-field!!! If you have fields with a . that should not changed, you have to modify it to your needs.


Re: Problem with auto-fill

Posted: Fri Aug 16, 2013 5:36 pm
by digitalphotoworld

Another question: How could I solve the problem on listpage, e. g. if I use master-/detail?


Re: Problem with auto-fill

Posted: Fri Aug 16, 2013 5:59 pm
by Webmaster

Select by $("[data-field=x_YourSourceField]") instead. (Requires v10.0.1.)


Re: Problem with auto-fill

Posted: Fri Aug 30, 2013 5:10 am
by digitalphotoworld

The code above works fine in listpage (Gridadd), but not with Master-Detail Add (as Detail). How could I resolve the problem?


Re: Problem with auto-fill

Posted: Fri Aug 30, 2013 4:54 pm
by danielc

Are you put the code in Add/Copy Page (in Client Scripts->Table-Specific) instead of List Page for your master/detail add?