by rtresidd » Mon Sep 03, 2012 2:18 am
Hi Steve just checking how this update is coming along.
I've got a dropdown list that is filled with a concatenated string that merges a couple of tables..
Basic table layout...
BoardItems:
id_BoardItems > primary key
fk_BoardRevisionId > relationship with BoardRevision
BoardRevisions:
id_BoardRevisions > primary key
fk_BoardTypeId > relationship with BoardType
BoardRevisionNumber > varchar eg 01
BoardTypes:
id_BoardTypes > primary key
BoardNumber > varchar eg 001
BoardName > varchar eg FooBoard
valuelists.ini
[Board_Listing]
; This lookup is used for assigning a Board to a piece of equipment
__sql__ = "SELECT C.id_BoardItems, concat(A.BoardNumber, '-', B.RevisionNumber, '-', A.BoardName, ' - ', C.BoardSerialNumber) AS Board FROM BoardTypes A, BoardRevisions B, BoardItems C Where B.fk_BoardTypeId = A.id_BoardTypes AND C.fk_BoardRevisionId = B.id_BoardRevisions ORDER BY A.BoardNumber, B.RevisionNumber, C.BoardSerialNumber"
Each real world "Board" can be of a specific "Revision" of a specific "Board Type"
so the drop down list gets filled with something like
XXX-YY-BlaType-ZZZZ
This is probably pretty difficult(impossible within the framework) but... I'd like to filter what is available in the drop down list in 2 stages if possible..
There would be 3 drop down boxes in total
First would allow the user to select the "Board Type" and the second one the "Board Revision" (filtered based on what revisions are available for the previously selected board type).
This would provide a filtered list in the final drop down that would list the available serial numbers for that Board Type/Revision.
I'm not really sure how best to tackle this.
There are some javascript examples showing dynamic filtering of drop down lists but I'm not sure exactly how I can hook something like that into the "add existing" form...
We've also used some submit methods generated by onchange handlers to perform a submit without setting a "save" flag and then had the php regenerate the drop down lists based on the submitted information.. But again not sure how I'd put something like that into the framework? also not sure If I can create the three separate drop down boxes on the same form??
Any hints would be appreciated.
Cheers
Richard