Looking for the right hook to trigger SQL query

Home Forums Quform WordPress Looking for the right hook to trigger SQL query

This topic is: resolved
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #33881
    csimstewart
    Participant

    I’ve written a PHP function which will perform a lookup in a custom table and pull in additional values to populate a Quform dropdown. I want this function called after the user enters input into a certain field. The function is currently set up with a static value for testing and is functioning properly using the
    add_action('quform_pre_display_1', 'my_form_values');

    However, this only works with my static testing value as this hook launches before any input from user. What hook can I set to send the value and trigger my function after the input for that part of the form is entered?

    Basically the user picks a product and I lookup the current pricing options and return it on the next section of the form.

    $product = $form->getValue('quform_1_10');

    this $product will be used in the WHERE statement of the sql query.

    Thanks for any help in advance!

    #33882
    oivanr
    Participant

    Hi,
    This must be done through a js function calling php.
    I suggest to read this subject: php call through ajax
    Regards,

    #33887
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33904
    csimstewart
    Participant

    Thank you @Ally and @oivanr. Both of those suggestions helped me get everything working from that initial issue question. I have a follow up question that I cannot find an answer for anywhere. Is there a jquery constructor similar to:
    options.push (new Option(value, value));
    which then:
    $element.html(options).prop('selectedIndex', 0);
    but will work on populating the options for a checkbox element in QuForm rather then the example of a dropdown? Or will I have to code all of the html variables as .append and generate the structure myself to push into the .html()?
    Thank you both for your help!

    #33907
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #33950
    csimstewart
    Participant

    Thank you very much. Those posts contained the code hints I needed to get started solving each of my issues.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy