Wednesday, October 29, 2008

[jQuery] Re: [validate] Problem with validation on a form pulling in with Ajax

Yes, thats why its called a testpage. You need to strip anything
unrelated so that we can focus on the actual problem.

Jörn

On Wed, Oct 29, 2008 at 10:16 AM, ryanhavoc
<rjtaylor@havocinspired.co.uk> wrote:
>
> Yes, $("#attendee_editForm") is the id of the form being pulling in.
>
> It's difficult to create a test page as it's linked to confidential
> data at the minute.
>
> On Oct 28, 11:01 pm, "Jörn Zaefferer" <joern.zaeffe...@googlemail.com>
> wrote:
>> Does $("#attendee_editForm") match any elements? A testpage would help.
>>
>> Jörn
>>
>> On Tue, Oct 28, 2008 at 5:38 PM, ryanhavoc <rjtay...@havocinspired.co.uk> wrote:
>>
>> > I have a script that generates a form. I'm pulling this form into a
>> > dialog box on my main index page via Ajax and trying to attached the
>> > Validate plugin to the form.
>>
>> > So I've got this:
>>
>> > $("a.attendee_add").click(function() {
>> > //Get href from link
>> > var addURL = $(this).attr("href");
>>
>> > //Ajax get from href link
>> > $.get(addURL, function(data){
>> > //Display content in dialog box
>> > $(data).dialog({
>> > height: "auto",
>> > width: "auto",
>> > resizable: false,
>> > draggable: false,
>> > position: "center",
>> > modal: true,
>> > overlay: {
>> > background: "#333333"
>> > },
>> > close: function(ev, ui) { $(this).dialog("destroy").remove(); }
>> > });
>>
>> > //Attach validate plugin
>> > $("#attendee_editForm").validate();
>> > });
>> > return false;
>> > });
>>
>> > However it doesn't work.
>>
>> > If I don't pull the form in with ajax and instead just paste it into
>> > my index page and add in $("#attendee_editForm").validate(); to the
>> > document ready function it works so I know my form is marked up
>> > properly.
>>
>> > Has anyone any idea how I can get this working?
>>
>> > Thanks

No comments: