• Resolved vickydam

    (@vickydam)


    Congratulations on your great work and this great plugin!
    My question is:

    I am using the wpdadiehard shortcode on a web page to display a specific set of rows, using the following hyperlink structure: /new-session/?wpda_search_column_bns_sale_code=3.

    Let’s say that my table has 3 columns, bns_sale_code, bns_sale_date, bns_sale_time.

    Is it possible when I add a new row through that page, the value for bns_sale_code to be set already to 3 and for the user to add the rest of the fields, that is only the date and the time?

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi @vickydam,

    Thank you for your compliment! ??

    Let me see if I understand your question correctly. When the user presses the link, he is redirected to page /new-session/?wpda_search_column_bns_sale_code=3. The page goes into insert mode and automatically enters 3 into field bns_sale_code. The user enters the date and time. Is that correct?

    Presuming I understand your question correctly, you first need to make sure the page goes into insert mode. You can achieve that by adding the action argument to your url:
    /new-session/?action=new&wpda_search_column_bns_sale_code=3

    Next you can use the wpda_after_simple_form action hook to grab argument wpda_search_column_bns_sale_code from the url and write it into field bns_sale_code:
    https://wpdataaccess.com/2020/01/29/action-hook-wpda-after-simple-form-to-add-custom-elements-to-end-of-data-entry-forms/

    If you prefer not to use the action hook, you can also use the Code Manager to write some custom code for that page specifically. I think the php as well as the javascript shortcode shoudl work.
    https://code-manager.com/blog/docs/index/shortcodes/php-shortcodes/
    https://code-manager.com/blog/docs/index/shortcodes/javascript-shortcodes/

    I’ve used the same parameter as you did: wpda_search_column_bns_sale_code
    This parameter will be recognized by the plugin as a “search for value” instruction. If you just want to transfer the value of field bns_sale_code, I would suggest to use a different parameter name. That might prevent search issues.

    Does this help?

    Thanks,
    Peter

    Thread Starter vickydam

    (@vickydam)

    Hi again!

    Sorry for the late reply, I was trying to work out a solution.
    Yes that was exactly my question. I am afraid that my programming experience is limited so I would not manage to use your solution without further help.

    Still, I found an alternative through parent/child pages, that does exactly the job!

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Setting value of table field through hyperlink parameter’ is closed to new replies.