Personal Activities Calendar Program - Error Message For Missing Form Data - 2
|Now that we have completed the changes to the function call in the Activity Entry script, we need to add the changes to the Activity_Entry_Form function that will handle the error message. We need to add the new parameter variable to the list of variables being received by the function. If we don't, then the function will not recognize the $error_message even if we send it. So let's add the receiving variable called $prev_error_message to the list.|
When the value of the $prev_error_message is set to yes, we will want to display an error message on the form. We can do this with a simple if statement and a new variable we will call $message_text. This variable will hold the text of the error message. We will first initialize this variable to null. Then if the $prev_error_messaage is equal to yes, we will set the variable to the text of the error message.
1. We have set the initial value of the $message_text to null. If the program has not encounter any missing data, the $message_text remains set to null and no message will appear in the form.
2. If the program has encounter missing data, we will set the $message_text variable to the error message we wish to show on the web form.
Finally, we will add the $message_text variable to the web form code in the location where we wish the error message to display. If it is not set to null, the message will be displayed.
This site needs an editor - click to learn more!
Editor's Picks Articles
Top Ten Articles
Content copyright © 2019 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.