Question

I am trying to get Ajax autocimplete for JQuery to work with a PFBC form.

Just setting id to "query" through the option, does not trigger the autocomplete js to run.

$this->addElement(
    new Element\Textbox(
        "Partner:", 
        "Institute", 
        array(
            "required" => 1, 
            "id"=>"query"
        )
    )
);

At the end of the page I have added:

<script type="text/javascript">
    var options, 
        a;
    jQuery(function() {
        options = {
            serviceUrl: 'script/autocomplete.php' 
        };
        a = $('#query').autocomplete(options);
    });
</script>

and autocomplete is set to sput out a json array as in the example. In the header I have included jquery and the autocomplete script.

The only thing I can think of to do is to set an OnChange trigger to the field, but I cannot find out how to do this with the php form building class, PFBC

Can someone help me with this?

Était-ce utile?

La solution

As the class is giving me problem after problem, and the online documentation stinks, I have decided to drop PFBC for now, and write my own form class. The time I have spent working on PFBC trouble is more than I would need to get my own class together.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top