Topic: Xajax, Jquery and form

Hi everyone!

I have a form, and I'm validating the user with xajax of course, the following is how I currently call the function with jquery:

Code: PHP

$(document).ready(function(){

    $("#frmLogin").submit(function(){

        xajax__validate_admin(xajax.getFormValues(this));

        return false;

    });

});

 

I am redirecting the user to the appropriate page from php whenever the login is good, but from jquery is there any way to find out if the login is a success?

Thank you!

Re: Xajax, Jquery and form

Please help - I must be missing something, because I cannot get my jQuery to work with my xajax.

My xajax is creating a table asynchronously (w/o page refresh), but my $(#store_body).hide(); in my jquery.js is not hiding the store_body div created from this table. The $(#store_body).hide(); is loaded when the page first loads, so there may be some disconnect between the 2.

So I tried $objResponse->Script("$(#store_body).hide();"); but still nothing.

In my firebug I am getting this

Code: PHP

<cmd cmd="js">S$(#store_body).hide()</cmd><cmd cmd="as" id="div_table" prop="innerHTML"

><![CDATA[S<table class="styledTable"><tr><th width="20%" class="title">St . . .



...etc

 

What am I missing? I've seen a little here-and-there about a jQuery plugin, but nothing explaining it simple enough for me to play with. Is there something else I need to be loading to get access to the jQuery stuff?

Re: Xajax, Jquery and form

@Jagarm you could use a html element as memory for a variable

@fielder if jquery is loaded in the head of your page, you can use it, i dunno if thats the mistake but it should be $('#store_body') instead of $(#store_body) or better $('store_body') if you want to select using the id of an element

Re: Xajax, Jquery and form

Ok, I'll give it a shot but I've tried just about everything.

So although I'm hiding a particular <div> id in my jquery.js (on page load) before it even exists on a page, when xajax does creates it (w/o page refresh) the jquery will affect it and be hidden?

See what I'm initially loading is

Code: PHP

$(document).ready(function() {



    $('#button_showstore').click(function() {

        $('#store_body').slideToggle("fast");

    });



    $('#store_body').hide();

});

 

like I said this div doesnt exist at the time of the page load. I want it to be hidden though when it is finally created by xajax.

Code: PHP

<div id="store_body">Hidden Information Goes Here</div>



<a href='JavaScript:void(0);' id='button_showstore'><img src='../../../assets/images/icons/shape_square_edit.png' /></a>

 

Then obviously I want to be able to click on the button to toggle the hide/unhide.

Last edited by Fielder (2009-06-22 12:13:09 AM)

Re: Xajax, Jquery and form

It didn't help.

In fact I've created a working<div> that is loaded at pageload with a button_showstore, and it works as expected. But it just doesn't act on the dynamically created <div>s from the xajax code.

It doesnt have anything to do with the fact that the <div> is inside a table?

Code: PHP

<table>

<tr>

<td><div id="store_body">Hidden Information Here</div></td>

</tr>

</table>

 

Last edited by Fielder (2009-06-22 12:22:35 AM)

Re: Xajax, Jquery and form

Are you trying to create multiple rows with the hidden information?  If so, you will need to add a row number to the ID (or in some other way, make the ID unique).

Otherwise, you should be able to assign a value to the innerHTML of the DIV

// Joe

xajax Developer
Connect to me on LinkedIn:
http://www.linkedin.com/in/calledtoconstruct

Re: Xajax, Jquery and form

Yes Im trying to add multiple hidden rows, and right now they are all the same id. So with what you said, I presume each row will need to be unique in order for the jQuery to properly function (hide and slideToggle)? I'll give it a shot this evening. THanks.