Jump to content


Form autorefresh help

  • Please log in to reply
3 replies to this topic

#1 robcrozier

  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 21 October 2006 - 12:18 PM

Ok, what I’m trying to do is prompt a user for some input from a form, I then want this input to be validated and if the data entered is valid, I want another form to automatically be displayed below this one.  I've seen it done loads of times and when I’ve used them in the past on other websites, the whole page does not seem to refresh - the new form or form field just appears.

Can someone shed some light on this for me, does the whole page need refreshing (I can manage if this is the case).  Or is there another way of doing it.


#2 obsidian

  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 21 October 2006 - 12:32 PM

one word: AJAX. what is happening is that when the focus goes OFF of a field, there is an HTTP request made that validates that field. once it is confirmed that all the fields are valid, the javascript that has been performing the HTTP requests simply tacks on the additional fields or form to the end of the page. sounds simple in my explanation, but there is definitely a lot to it.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 robcrozier

  • Members
  • PipPipPip
  • Advanced Member
  • 175 posts

Posted 21 October 2006 - 12:35 PM

Cheers mate, but what is AJAX?

#4 fenway

  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 22 October 2006 - 08:19 PM

It's just another way of having a child process of the current window go round-trip to the server.  AJAX is just the fanciest, new-fangled way.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users