Okay
  Public Ticket #1759970
Including related ID in new record
Closed

Comments

  •  2
    Carl Nasal started the conversation

    I have two tables in a DB:

    person
    person_phone

    I have a page in WordPress that accepts a person_id parameter and shows details about that person.  I'm trying to use wpDataTables to show the phone numbers associated with the person.  The display is working well as I'm using %VAR1% to pass in the person_id.  When adding a record, I have person_id being defaulted to %VAR1% which is also working, but I would like to not have the person_id be shown or editable  by the user in the New record dialog.  Is there a way to hide that field, but still pass the data to the DB?

    Thanks,
    Carl

  • [deleted] replied

    Hi Carl,
    Thank you for your purchase. 

    Easiest way would be to just hide the input with CSS. Other option would be to use our built in hooks like wpdatatables_filter_frontend_formdata( $formData, $tableId ) to intercept the data sent from the frontend and add necessary changes (for example current_user_id to person_id column) - Documentation

  •  2
    Carl Nasal replied

    Great tips. I’m sure one of those will work.


    Thanks!

    Carl