Reading values from selected Detail rows

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

Reading values from selected Detail rows

Post by Teessider66 »

I have a Master table (Person ID, Name etc,) and a Detail table for entering that person's payments for various items. So on a page I have the master record and a details table with multiple rows for entering payments. I have a drop down list for selecting the purchased item and want to detect the selection and fill in the Payment Due in the second field.

The cell id of the first row for the selected item is #x1_PaymentCategory and I want to calculate and populate #x1_PaymentDue for the payment due (not a simple lookup). I can use the $("#x1_PaymentCategory").change function to process the selection for first row, but don't want to have to write the same procedure for the second row #x2_PaymentCategory, and the third row #x3_PaymentCategory and so on.

Is there are way to write a generic procedure or function to detect a change to the PaymentCategory cell in any row and process it accordingly?


mobhar
User
Posts: 11726

Post by mobhar »

Please refer to the generated Javascript validation code in the Add Page. Let's say we're talking about "orders" table in the demo project. In "ordersadd.php" file, just search for this code:

fordersadd.Validate = function() {

As you can see, inside that function, there is "infix" variable which will handle if the validation is being used by "gridinsert". You may simply use that validation for your detail tables. Just put your Javascript validation code in "Startup Script" that belongs to the List Page of your detail table.


Teessider66
User
Posts: 7

Post by Teessider66 »

Excellent, thank you very much,

I would never have thought to look under validate.


Post Reply