different form depending on category [thedeadone.net Forums]

来源:百度文库 编辑:神马文学网 时间:2024/04/28 15:26:02

I’m not sure you need “ajax” per say, but certainly javascript.

What I would have do is create a page template in your theme and inthis theme, create all the forms you wish to display dynamically usingthe template tags (i.e. tdomf_the_form(id of form)). Then use a bit ofjQuery magic to hide all of them except the one you’re interested in.

I did a small test and managed to get it to work using a pagetemplate. This is the code I added to switch dynamically between 4different forms depending on a radio button:







































You should be able to use that as a base to do more funky things.The builtin jQuery in Wordpress 2.7 allows you to do some nice stuff,like fading in and out the form. And it seems to work fine with a mixof forms using AJAX or non-AJAX too.