• rocke

    (@shashibhushan)


    I am using “contact-form-manager” Plugin for my inquiry page

    i have many field but need help in 2 place of field

    Textbox and Select option

    all is working fine , from back end i can create forms, and its displaying properly in front end

    But there is some change i need to do :

    localhost/project/?page_id=56&motion=aamir-khan&id=2 – where “?motion” is my custom Taxonomy , not custom post . AND pageid=56 is my inquiry page

    Send Details about Motion hence when i come to inquiry page

    my textbox should be fill be : aamir-khan ( as per motion taxnomy )
    and my select option should be selected as : motion ( as per id:2 )

    as i have already pass two parameter through above link

    How i can do the same

    https://wordpress.org/plugins/contact-form-manager/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator bcworkz

    (@bcworkz)

    You should be able to do this with javascript or jQuery. I would think the request URL is available to JS, I’m just not sure how to actually get it. The form fields should be easily referenced since they must be uniquely named for the form to work. Then it is just a matter of setting the value of the textbox and setting the proper select option as selected.

    Thread Starter rocke

    (@shashibhushan)

    Hey Bcworkz

    Thanks bro for reply,

    bro, actually the forms and its fields are created dynamic from admin panel of its plugins.

    hence can you please let me know in more details, as in which php files i need to do something .. as its created dynamically hence i don’t see any related code

    Moderator bcworkz

    (@bcworkz)

    Right, I understand the dynamic nature of the forms, that is why javascript is a good solution, it does not affect nor change how the plugin works. The javascript is applied client side after PHP is finished. There is no PHP to edit except to enqueue your script so it is loaded with each page. This can be added to a child theme functions.php, or you can create a very basic plugin.

    To determine how to reference each form element you want to populate, view the form in your browser using HTML source mode. Ideally you will see something like <textarea id="blah">. Then you can get the HTML element by ID of “blah” and set the value of that element to that taken from the URL parameter.

    Thread Starter rocke

    (@shashibhushan)

    Hey Bcworkz,

    Actually i am week and new to JS : hence can you please explain with some example , also pls take URL PARAMETER AS:
    =========
    localhost/project/?page_id=56&motion=aamir-khan&id=2 – where “?motion” is my custom Taxonomy , not custom post . AND pageid=56 is my inquiry page

    Send Details about Motion hence when i come to inquiry page

    my textbox should be fill be : aamir-khan ( as per motion taxnomy )
    and my select option should be selected as : motion ( as per id:2 )
    ==========

    Moderator bcworkz

    (@bcworkz)

    Sorry, my JS is very rusty, I’m not able to provide a functional example. Here is more information to help you figure this out on your own.

    You can get the URL with window.location, then use string processing functions to search and extract the parameter values you need. You can access the form elements by ID with getElementById(), so you can set the element value like so:

    motion = /*string functions to extract URL parm here*/
    elementref = getElementById('blah');
    elementref.value = motion;

    Once you’ve developed the JS page, cause it to be loaded for your WP page in PHP with
    wp_enqueue_script()
    . Sorry I can’t give you a better example, good luck with the rest.

    Thread Starter rocke

    (@shashibhushan)

    its ok, thanks … at least this much can help me

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom – Parameter in contact-form-manager Plugin’ is closed to new replies.