Call Autofill with Default Add Value

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

Call Autofill with Default Add Value

Post by kirondedshem »

I have a field user_account which users lookup to a view that has id,name,amount_available. I set lookup id = id, and display field 1 = name. I then enable force selecteion. I then set the view controll as select.

On same form I have a filed amount_before. SO I set user_account to auto fill the amount_before with the amount_available from the view when selected.

When I run the add & edit forms, This works fine and I can select a user and see the amount_beofre changing as well.

I want when a user logs in accesses this form I want thier user_Account to be pre-selected. So I go to the filed settings of the user_account field and set the Default Add value to the function to get the current user.
This also work well where, depending on logged in user, when I go to add / edit forms, I see thier account pre-selected.

Problem is the autofill does not work even after the record is pre-selcted, But when I selct it myself it works so I think the autofill does not fire when you have default value in add.

How can I go past this.


arbei
User
Posts: 9359

Post by arbei »

The autofill does not work with the default value of the lookup field because the "change" event is not triggered.

You need to trigger it by your code.

  1. Subscribe the "updatedone" event (read example in help file topic: "Server Events and Client Scripts" -> "Client Script" -> "Example 3".
  2. Trigger the change event by your code.

For example:
$(document).on("updatedone",function(e, args){
if (args.target.id == "x<Field>")
$("#x
<Field>").change();
});


Post Reply