![]() |
|
||||||||||
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
|||||
|
|
#1 |
|
WLC Member
Join Date: Nov 2007
Location: Sydney
Posts: 19
|
Hello
I am trying to make a form - just one question with 3 options but I dont want anything to happen when its submitted just to remain on the page something like the small polls you see, but I need to collect the responses as well thanks for any help A
__________________
Why buy beautiful things when you can do beautiful deeds? |
|
|
|
|
|
#2 |
|
Banned
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
|
leave the action attribute empty for a form that submits to itself.
<form .... action="" ...> |
|
|
|
|
|
#3 |
|
WLC Member
Join Date: Jun 2010
Posts: 22
|
If you want it to remain on the page it's been sent on, this is going into AJAX. Basically, the form submits to a page through Javascript, as if attempting to get an XML file.
It is, however, kinda complicated - I'm not sure how much experience you have? http://www.tizag.com/ajaxTutorial/ajaxform.php - that's a link to a tutorial explaining through it, if you're confident enough with Javascript though
__________________
To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. |
|
|
|
|
|
#4 | |
|
Banned
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
|
Quote:
|
|
|
|
|
|
|
#5 |
|
WLC Member
Join Date: Jun 2010
Posts: 22
|
...It does if you want the form to do anything? Your code would load the original page again; not remain on that page. There's a difference.
__________________
To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. |
|
|
|
|
|
#6 |
|
Banned
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
|
Do I take it that you're not a programmer then?
![]() You simply include the code that handles the form data in the document, then check for the submit button being pressed or form data being present. Then you either process the form data or show the form to the user. |
|
|
|
|
|
#7 |
|
WLC Member
Join Date: Jun 2010
Posts: 22
|
Or we can take it that you're not thinking about this properly...
If he's trying to create a poll, then he'll need it to submit to a server-side page to register the results of the form. If he wants it to remain on the page, without reloading the page, he will need AJAX to allow the javascript to communicate with the server-side file. Simply reloading the page with the server-side code on that page will not have the same effect.
__________________
To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. |
|
|
|
|
|
#8 |
|
Banned
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
|
Oh please, would you like me to demonstrate how simple it is to collect form data ON THE SAME PAGE as the form is??
Vote in a poll, send email, login, add comments to a page, or ANYTHING Let me know and I can have a demonstration page live and fully operational for you in under 30 minutes! WITHOUT any use of AJAX at all!! How do you think this was done BEFORE AJAX came along?? |
|
|
|
|
|
#9 | |
|
WLC Member
Join Date: Jun 2010
Posts: 22
|
You're missing the point. AJAX does it without reloading the page.
albert1955: Quote:
Please don't get upset. I'm not saying that what you're saying is wrong. Yes, what you're saying will work. However, it does not work without anything happening.
__________________
To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. | To view links or images in signatures your post count must be 5 or greater. You currently have 0 posts. |
|
|
|
|
|
|
#10 |
|
Banned
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
|
and the title says "Simple form without any redirect" There is ABSOLUTELY no need to start adding complications such as AJAX when it is ABSOLUTELY unnecessary.
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
Linear Mode |
|
|