WeLoveCSS Logo
Home Profile Members Search Rules Help New Posts



WeLoveCSS > WEB DESIGN > HTML & XHTML > Simple form without any redirect

Reply
  Thread Tools Display Modes
Old 7th June 10, 06:50 AM   #1
albert1955
WLC Member
 
albert1955's Avatar
 
Join Date: Nov 2007
Location: Sydney
Posts: 19
Default Simple form without any redirect

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?
albert1955 is offline   Reply With Quote
Old 10th June 10, 12:24 PM   #2
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Simple form without any redirect

leave the action attribute empty for a form that submits to itself.
<form .... action="" ...>
chrishirst is offline   Reply With Quote
Old 13th June 10, 01:58 PM   #3
MinatureCookie
WLC Member
 
MinatureCookie's Avatar
 
Join Date: Jun 2010
Posts: 22
Default Re: Simple form without any redirect

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.
MinatureCookie is offline   Reply With Quote
Old 13th June 10, 04:22 PM   #4
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Simple form without any redirect

Quote:
If you want it to remain on the page it's been sent on, this is going into AJAX.
No it doesn't!
chrishirst is offline   Reply With Quote
Old 13th June 10, 04:32 PM   #5
MinatureCookie
WLC Member
 
MinatureCookie's Avatar
 
Join Date: Jun 2010
Posts: 22
Default Re: Simple form without any redirect

Quote:
Originally Posted by chrishirst View Post
No it doesn't!
...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.
MinatureCookie is offline   Reply With Quote
Old 13th June 10, 04:57 PM   #6
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Simple form without any redirect

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.
chrishirst is offline   Reply With Quote
Old 13th June 10, 05:04 PM   #7
MinatureCookie
WLC Member
 
MinatureCookie's Avatar
 
Join Date: Jun 2010
Posts: 22
Default Re: Simple form without any redirect

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.
MinatureCookie is offline   Reply With Quote
Old 13th June 10, 05:57 PM   #8
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Simple form without any redirect

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??
chrishirst is offline   Reply With Quote
Old 13th June 10, 06:09 PM   #9
MinatureCookie
WLC Member
 
MinatureCookie's Avatar
 
Join Date: Jun 2010
Posts: 22
Default Re: Simple form without any redirect

You're missing the point. AJAX does it without reloading the page.
albert1955:
Quote:
I dont want anything to happen when its submitted
The page reloading would be something.

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.
MinatureCookie is offline   Reply With Quote
Old 13th June 10, 06:25 PM   #10
chrishirst
Banned
 
Join Date: Jun 2006
Location: Blackp ool U.K.
Posts: 3,197
Default Re: Simple form without any redirect

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.
chrishirst is offline   Reply With Quote
Reply


Thread Tools
Display Modes
Linear Mode Linear Mode

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:23 AM.



Home | Advertise | Contact Us | Top
Home | Advertise | Contact Us | Top

Copyright© 2006 WeLoveCSS.com. All Rights Reserved.
Powered by vBulletin Version 3.8.4 Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.