Validating against value in linked table.

Validating against value in linked table.

MickBMickB Posts: 103Questions: 25Answers: 2
edited February 2016 in Free community support

Hi,

I'm struggling with this:

I have a records table which has a foreign key product_id:
id product_id best seconds pitched
1 6 5 1 3

and a products table
id part_no description
6 BELG001 something

My user wants to edit the records table and modify the part_no, which is displayed in the Datatable.

Usually I would use a select for things like this, but I have a lot of products (30,000) and just want to let the user type in what they want, then validate.

I am trying to do it with something like this:


Editor::inst( $db, 'records' )->where("records.deleted_at",null) ->fields( Field::inst( "records.id" ), Field::inst( 'products.part_no' ) ->options('products','part_no','id') ->validator( 'Validate::dbValues' ),

Is this possible?
Does that make sense?
Am i being stupid? :-)

Maybe I should use a Select2...

Mick

This discussion has been closed.