evsion
03-19-2008, 06:07 PM
Hi guys,
I wanted to know if anyone knows a script like this? A dynamic form. Thanks
https://www.gameservers.com/order/step2.php?game=24&step1.x=35&step1.y=6
etogre
03-19-2008, 06:21 PM
That's just some javascript and looks like maybe a little PHP backend.
If you really want to get into it, go look up some AJAX tutorials. You can do some amazing things once you know how to.
In fact, that form could use some AJAX to smoothen things out a little bit.
As you can see, the page reloads when you select the game server. With AJAX you could update the form without reloading the page.
evsion
03-19-2008, 08:08 PM
Thanks etogre.
Do you know some templates I can play around with?
etogre
03-19-2008, 08:26 PM
I wish I could point the way to a good resource. I'm getting into AJAX myself still so I'm not even sure how to go about doing it.
evsion
03-19-2008, 09:14 PM
Thanks tho. I'll just wait here and see if other users have any other tips/resources for me.
Cheers,
Saeven
03-20-2008, 11:27 AM
It's fairly simple. This is what the idea is:
The setup..
1. Store some base-state on the back-end's session
2. Display a basic form that has onselect/onclick events which generate XHOR requests when clicked
In action
3. When the user actuates the commands on the form, you send a post via XHOR to your back end. This post can contain anything you like, either the total state of the form (inefficient) or the actuated form object's new value. (ex. via XHOR, http://yoursite/formhandler.php?toggled=form_object_id&value=newvalue)
4. Your back-end manipulates what was received, and potentially may cause the expansion/change/removal of some of the form's items. The form returns some JSON, that tells the javascript on the form page to edit/adjust its display.
5. Repeat 3-4 ad nauseam until submitted.
A good library to get you started with XHOR is Ext, see http://extjs.com. Manipulating forms like this is not difficult, but must be done carefully. If your options are very complex, your back end will likely reflect this itself. If it helps, I have a basic example of this that you can view, using Ext, divs, and javascript, I expand/contract options on demand. If you want to PM me, I can send you a URL where you can see a form like this in action as example. I'd post the URL here, but being a part of one of our products, our competitors that troll this board are usually extremely quick to report our posts in an attempt to strike our account.
In the example I would send, taking a look at "view source" before and after you toggle any of the questions at the top of the form. You would see how divs are added and removed. Combined with Firefox and FireBug, you can also spy on the XHOR requests to see how the form is actuating its dynamic add/remove requests.
Hope this helps a bit!
Alex