WordPress.org

Ready to get started?Download WordPress

Forums

Calculated Fields Form
[resolved] Using jquery autocomplete (9 posts)

  1. Tyxiquale
    Member
    Posted 1 year ago #

    Hi,

    I am trying to use autocomplete in one of my forms, whereby a user can start typing a suburb, and a dropdown list of options appear.

    If I edit the cp_calculatedfieldsf_public_int.inc.php file with a new form input text box just before the submit button, the autocomplete works.

    The code in the header is something like this

    $(function() {
    var availableSuburbs= [
    "Suburb1",
    "Suburb2",
    ];
    $( "#form_structure" ).autocomplete({
    source: availableSuburbs
    });
    });

    However, I am having trouble implementing it inside a textbox WITHIN the form by changing the field label to:

    <input type="text" id="Suburb" name="Suburb"/>

    Is there any way to make this work?

    Thanks in advance!

    http://wordpress.org/extend/plugins/calculated-fields-form/

  2. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    I need to check your web page to get a complete idea of the customization you have made.

  3. Tyxiquale
    Member
    Posted 1 year ago #

    The website is:

    http://www.homelover.com.au/quote/

    I have included the text input just before the submit button just to test. The autocomplete jquery seems to work fine, but I can't implement it into the main form itself.

  4. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Suppose you have an input field in the form that wants to convert to autocomplete, ok.

    First, assign a class name to the field, for example "my_autocomplete" (Select the element in the form and set the class name in the attribute: "Add Css Layout Keywords" )

    Now, the code to create the autocomplete in the header should be modified as below:

    $(function() {
    var availableSuburbs= [
    "Suburb1",
    "Suburb2",
    ];
    $( ".my_autocomplete input" ).autocomplete({
    source: availableSuburbs
    });
    });

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    Pay attention, I've modified only the field's selector.

    That's all.

  5. Tyxiquale
    Member
    Posted 1 year ago #

    Hi codepeople,

    Thanks for the prompt response.

    Please excuse my lack of understanding, but as I understand it, you changed the autocomplete selector from the ID to the class of the field input.

    I tried exactly as you instructed, but it still doesn't work.

    The following is what I tried:
    ".my_autocomplete" - works with standard HTML <input type="text" class="my_autocomplete">, but not with editing the class attribute in the form editor.

    ".my_autocomplete input" - works with neither

    ".fields.my_autocomplete input" - works with neither

    ".fields.my_autocomplete" - works with neither

    Am I understanding this incorrectly?

    Thanks again.

  6. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    The code is fine but you must to remove the autocomplete field that is out of form, because you have assigned to this field, the same class used to identify the element in the class.

  7. Tyxiquale
    Member
    Posted 1 year ago #

    Hi,

    I have created another form with only one input, and I have done exactly as you have written, yet it still does not work. I'm out of ideas.

    http://www.homelover.com.au/temp-2/

    Do you have a working example of jquery within a form that was created by this plugin?

    Thanks

  8. codepeople
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Could you contact me through our support system, please?

    http://wordpress.dwbooster.com/support

    I'll need the access to your WordPress to modify your first form, and then you may use it as reference for futures uses.

    Note: The URL you sent me (http://www.homelover.com.au/temp-2/) respond with a 404 Error, File not found

  9. Tyxiquale
    Member
    Posted 1 year ago #

    Hi codepeople,

    Thank you for fixing the code for me. It is REALLY appreciated. You were right, the code was correct - it was because I had linked another jquery file.

    The autocomplete works perfectly now. Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic