PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old September 15th, 2007, 11:39 AM
nickman nickman is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 3 nickman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 59 sec
Reputation Power: 0
Quickform general error echoing

Hi,

I'd like to ask a PHP+Pear Quickform question. The input fields of the website were built up with QF, and all of it has a SetElementError. After you submit, and error happens, then the errors will show up by GetElementError.

The question is the following, I'd like to solve that if any error happens, then PHP and/or QF will show an error message as well. I need it because the form is a bit long, more one page, and if the single error is on the bottom of the page, the user won't understand, why he/she got back to the form.

So I'd like to echo an error message on the top of the page, after the user clicked on the submit button, and any error happened.

thanks,
nm

Reply With Quote
  #2  
Old September 15th, 2007, 12:07 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 152 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 26 m 25 sec
Reputation Power: 2
And what is your question? I don't see a question in your post.

But you're likely wanting to use something like this:

if ($form->isSubmitted() && !$form->validate()) {
echo '<p>Please correct the following errors.</p>';
}

Reply With Quote
  #3  
Old September 15th, 2007, 12:21 PM
nickman nickman is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 3 nickman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 59 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
And what is your question? I don't see a question in your post.

But you're likely wanting to use something like this:

if ($form->isSubmitted() && !$form->validate()) {
echo '<p>Please correct the following errors.</p>';
}


You're right, I'd like to make something like this. The only problem is the following:
PHP Code:
if ($form->isSubmitted() && !$form->validate()) {
echo 
'<p>Please correct the following errors.</p>';
} else  {
echo 
'something';



When I load the page, it automatically shows "something" above the form. How can this be fixed, so "something" should appear only after when the submit button is clicked (but on the same pages as the form)?

thanks.

Reply With Quote
  #4  
Old September 15th, 2007, 12:25 PM
wiesemann wiesemann is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 152 wiesemann User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 26 m 25 sec
Reputation Power: 2
$form->isSubmitted() (as the name of the method indicates) is only true if the form was submitted. Therefore, you could split my example code, e.g. like this:

if ($form->isSubmitted() {
__echo 'something';
__if (!$form->validate()) {
____echo '<p>Please correct the following errors.</p>';
__}
}

(_ is used here because I don't know how to use intendation and highlighting here)

Reply With Quote
  #5  
Old September 15th, 2007, 04:06 PM
nickman nickman is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 3 nickman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 41 m 59 sec
Reputation Power: 0
Quote:
Originally Posted by wiesemann
$form->isSubmitted() (as the name of the method indicates) is only true if the form was submitted. Therefore, you could split my example code, e.g. like this:

if ($form->isSubmitted() {
__echo 'something';
__if (!$form->validate()) {
____echo '<p>Please correct the following errors.</p>';
__}
}

(_ is used here because I don't know how to use intendation and highlighting here)


Thanks your help, I could extend my code with this.

regards,
nm

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > Quickform general error echoing


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway