0

Odd behaviour on number fields

Have a slight strange issue on a pricing panel

On a quick quote form I have some cost/sell fields and users are encountering an issue with tabbing out of the cells versus hitting the Return/Enter key

If enter a cost price then tab out or press return

The update event fires and and updates the sell price as shown below (albeit without any profit cos the Mkup% has not been entered yet)

Now when I enter the markup % and tab out (the sell price does not update)

Unless I specifically press the Return/Enter key then the script on the Mkup% field will work.

From a function point of view.  want my cake and eat it. Thus after entering a cost I want to either enter a markup and calculate the sell ( but also be able to alter the sell price directly and have it recalc the markup....

My scripts do this - but it is just the fact that you can seem to tab out of both the cost and sell fields and the scripts(s) trigger but you can't seem to tab out of the margin field.... As Qty/Cost/Mkup% and Sell are all number fields and should function the same I therefore must have an error that I am not seeing....

Script on trigger after update in Cost Price field

'Sell Price' := 'Cost Price' * Mkup / 100 + 'Cost Price';
    round('Sell Price', 2);
 

Script on trigger after update in  Mkup% Field

'Sell Price' := 'Cost Price' * Mkup / 100 + 'Cost Price';
 

Script on trigger after update in Sell Price Field

Mkup := ('Sell Price' - 'Cost Price') / 'Cost Price' * 100

 

I have in the script if qty > 1 then do the script etc and also round the prices to 2 decimal places. but I have removed them to see if any impact - I have same issue whether they are there or not

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
Like Follow
  • 1 mth agoLast active
  • 12Views
  • 1 Following