Okay
  Public Ticket #2984131
New record default value from %VAR1%
Closed

Comments

  •  1
    Mattias started the conversation

    Hi again!

    I now have some wpDataTables going. I would like to add the value of %VAR1% to a column on new records. I don't want this column to be editable. When a new record is inserted, it should just set that column to that value. How can I do that? Php or any script that could fix that? I don't see any of this in the gui.

    This is a sql-table with a ms-sql query as a source.

    Thank you in advance
    Regards
    Mattias C

  •  1,851
    Miloš replied

    Hi, Mattias

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    - I actually sent you the wrong solution, and you already got it via Email. For some reason, I thought you wanted to prefilter the table using a variable in a column, as a placeholder.

    It was an honest mistake, hopefully, you can forgive me?smile.png

    - After a moment, I realised your actual goal was to prepopulate a field using %VAR1% placeholder.

    Custom fields cannot be prepopulated at the moment using variables; they need to be manually filled by the user I'm afraid. ( at least not with any built-in functionalities)

    It probably can be done with some custom work, but our developers are very busy at the moment, working on some priority tasks and fixing bugs and issues with our plugins, so they won't be having the time for custom work in the near future.

    You can always reach out to someone who does custom work, such as WP Kraken, but we can't advise on their pricing.

    I will double-check with them if they know of any easy workaround and will come back to this ticket when they respond, just to confirm.

    Terribly sorry for the mistake.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    Mattias replied

    Hi

    No problem, with the mistake. Glad you understood what I meant. But you got to be kidding, that a field can not be prefilled and not editable!
    There are all sort of options to edit only my own data and so forth, but no possibility add an record only for myself? 

    I wish there were something to hook on to, to write some php-code between the form post and the record being saved. That would be great. Then I could add whatever data and check nothing not allowed being posted. Or even cancel the post, and take care of it myself.

    Regards Mattias

  •  1,851
    Miloš replied

    Hey, Mattias

    - First, I want to apologise, because there is a workaround solution we came up with, I didn't see it straight away.

    - Now, the column, technically, has to be set to be editable, but you can block the input so that nobody can change it from the front-end if that makes sense. Here is an example with more details:

    Let's say we got a table that has a column "continent" and "countries". We will set the table to be editable, and on the column setting of "continent", we set a predefined value of %VAR1%.

    3025587010.png

    - you can either set the variable directly in the Placeholders tab; in this example, we set the continent to be Europe;

    8427920843.png

    or you can set the variable through the shortcode;

    8309669179.png

    and it will always be the value you predefined as a placeholder.

    5903276298.png

    - The best we can do about removing the ability to edit that column is this workaround:

     using custom CSS, in our case, where the column name is "continent" ( you will have to use the browser inspector to find the column name) :

    5273464603.png

    - and we use this custom CSS:

    input#table_1_continent.form-control.input-sm.editDialogInput {
      pointer-events: none !important;
    }
    

    - This will still make the input field visible, but it can not be changed/edited.

    Hopefully, that helps.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables