Get and set field instance into another table.

Get and set field instance into another table.

nigel pasconigel pasco Posts: 37Questions: 6Answers: 0

Hi guys,
I have run into another issue I am sure there is an obvious solution but I can't figure the syntax required from the manual/reference. I am thinking some kind of get/set is required.

I am trying to take a form input, insert it into one table, AND also insert the same input value into another table joined to the first. For example, the table "users" is joined to table "persons". When submitted, a form inserts the input "users.first_name" and also raises a new row in the "persons" table and enters the same value into "persons.first_name".

I have no issue with joining the tables, or creating the row in the joined table, however, an struggling to pass the form input into the joined table.

Has anybody done this before? Any assistance would be appreciated.
Thank you
nige

Replies

  • nigel pasconigel pasco Posts: 37Questions: 6Answers: 0

    No big deal, I managed to get around my issue by restructuring some tables and using the joins better. However, it would be interesting to know if the above is possible.

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin

    Fields in Editor's PHP classes have a 1:1 relationship with the fields in the database. So if you wanted to set two different fields, you would need to Field class instances.

    Having said that, it should be possible to use the setFormatter() function of the Field class to read a value form $_POST (i.e. the field that was set in the interface) and reuse that value for the second field.

    Allan

This discussion has been closed.