Multi-sourced form

Hi,

I am starting my adventure with DHTMLX and liked it pretty much so far. Now I have encountered a problem I am unable to figure out by myself.

I took a look through the forums and while there is a lot of information there, I am unsure any of the posts refers to similar situation like the one stated below.

I have a form, employee information, which is supposed to be filled with a person details then added/modified in the mysql database tables.

I have the following tables set in the db:

employees
(idx, first_name, middle_name, last_name, position_id, department_id, phone)

departments
(idx, department_name)

positions
(idx, position_name, position_payrate_min, position_payrate_max)

Now I need my form to be initially filled with data from ‘employees’ table with exception of department and position items, which should be read from ‘departments’ and ‘positions’ tables respectively into ‘select’ fields of the form each with an item selected according to department_id and position_id values from ‘employees’ table.

Then another issue is saving the data back to the db in the same manner - the indexes of selected items from ‘select’ lists of the forms should be put into department_id and position_id fields of the record in the table.

Is that something I can accomplish somehow with DHTMLX? Or I need ( still being a really fresh noobie with DHTMLX) to use good old fashioned php for that form? (I believe I will have few more “mixed-source” forms as a part of the application.

Any help is very much appreciated :slight_smile:

Cheers

Adam

Hello

Are you going to use form to add/edit single employee?

If yes - you can add combos which will contain all positions (1st combo) and all departmens (2nd combo). And then just load data from server like form.load() - they will automaticaly adjust corresponding text value. form.save() will send data to server.

More demos here:
dhtmlx.com/docs/products/dht … s/06_data/
(check save/load/options for combo)

If no - then please rpvide more details how you do plan your form will work and contain what data?

Hi Andrei,

Meanwhile I redesigned my approach and it seems to work so far :slight_smile: Thanks for the tips!