Allen Patrick
|
| Posted: 08/20/2002, 9:52 AM |
|
How do I change a label message in ccs php4 with templates? I am in
the event called after insert which creates a function called
function sendpassword1_AfterInsert() { //sendpassword1_AfterInsert
@7-49D214E6
I have a label called {message} which is on the html form. I need to
be able to use this field to tell the user if their password was sent
and if not why. I have been struggling with this for quite a while.
Is it possible to do from this event?
My embed code looks like the following. Please change it as you see
fit.
function sendpassword1_AfterInsert() { //sendpassword1_AfterInsert
@7-49D214E6
//Custom Code @12-2A29BDB7
global $DBccs_example;
global $sendpassword;
global $my_users;
global $dbl;
global $sendpassword1;
global $errormessage;
$errormessage = "No errors" ;
$control = mysql_insert_id ();
$last_email_added = CCDLookup("email","sendpassword","control=" .
$control , $DBccs_example);
$wherepart = "email='" . $last_email_added . "'" ;
$dbl = new clsDBccs_example();
$passwordtosend = CCDLookUp("user_password", "my_users", $wherepart ,
$dbl);
if(!strlen($passwordtosend))
{
$errormessage = "Your password was not found in our database" ;
}
$usernametosend = CCDLookUp("user_login", "my_users", $wherepart ,
$dbl);
if(!strlen($usernametosend))
{
$errormessage = "Your username was not found in our database" ;
}
$VariableName = $sendpassword1->email->GetValue(); // finally figured
out how to got the
// value of the message field or email field $sendpassword1 must be
global
$to_name = $last_email_added;
$from_name = "ipacmail@libnet.org";
$to_email = $last_email_added;
$recipient = $to_name . "<" . $to_email . ">";
$headers = "From:" . $from_name . "<" . $from_email . ">\n";
// $headers .= "Content-Type:text/html\n";
$subject = "Automated Lib/Net Library network information";
$message = "Your user ID for ipac is: " . $usernametosend . " and
password is: " . $passwordtosend . " http://www.libnet.org/ " ;
if ($errormessage == "No errors")
{
mail($recipient,$subject,$message,$headers);
}
else
{
// THIS IS WHERE I WANT TO SEND THE ERROR MESSAGE BACK TO THE LABEL
CALLED MESSAGE
}
//End Custom Code
Thanks in advance
|
|
|
 |
Sixto Luis Santos
|
| Posted: 08/20/2002, 11:11 AM |
|
Hello,
You may try using the OnValidate event to send the email, and if
unsuccessfull, add an error message to the form's error object.
eg:
$sendpassword1->Errors->addError("YOUR ERROR MESSAGE");
Regards,
Sixto
"Allen Patrick" <al@nugen.com> wrote in message
news:1cs4muca4ha7knmhdukk0djnd1mgqg91pb@4ax.com...
> How do I change a label message in ccs php4 with templates? I am in
> the event called after insert which creates a function called
>
> function sendpassword1_AfterInsert() { //sendpassword1_AfterInsert
> @7-49D214E6
>
> I have a label called {message} which is on the html form. I need to
> be able to use this field to tell the user if their password was sent
> and if not why. I have been struggling with this for quite a while.
> Is it possible to do from this event?
> My embed code looks like the following. Please change it as you see
> fit.
>
> function sendpassword1_AfterInsert() { //sendpassword1_AfterInsert
> @7-49D214E6
>
> //Custom Code @12-2A29BDB7
>
> global $DBccs_example;
> global $sendpassword;
> global $my_users;
> global $dbl;
> global $sendpassword1;
> global $errormessage;
> $errormessage = "No errors" ;
> $control = mysql_insert_id ();
> $last_email_added = CCDLookup("email","sendpassword","control=" .
> $control , $DBccs_example);
> $wherepart = "email='" . $last_email_added . "'" ;
> $dbl = new clsDBccs_example();
>
> $passwordtosend = CCDLookUp("user_password", "my_users", $wherepart ,
> $dbl);
> if(!strlen($passwordtosend))
> {
> $errormessage = "Your password was not found in our database" ;
> }
>
> $usernametosend = CCDLookUp("user_login", "my_users", $wherepart ,
> $dbl);
> if(!strlen($usernametosend))
> {
> $errormessage = "Your username was not found in our database" ;
> }
>
> $VariableName = $sendpassword1->email->GetValue(); // finally figured
> out how to got the
> // value of the message field or email field $sendpassword1 must be
> global
>
> $to_name = $last_email_added;
> $from_name = "ipacmail@libnet.org";
> $to_email = $last_email_added;
>
> $recipient = $to_name . "<" . $to_email . ">";
> $headers = "From:" . $from_name . "<" . $from_email . ">\n";
> // $headers .= "Content-Type:text/html\n";
> $subject = "Automated Lib/Net Library network information";
> $message = "Your user ID for ipac is: " . $usernametosend . " and
> password is: " . $passwordtosend . " http://www.libnet.org/ " ;
>
> if ($errormessage == "No errors")
> {
> mail($recipient,$subject,$message,$headers);
> }
> else
> {
> // THIS IS WHERE I WANT TO SEND THE ERROR MESSAGE BACK TO THE LABEL
> CALLED MESSAGE
> }
>
>
> //End Custom Code
>
>
>
> Thanks in advance
>
>
|
|
|
 |
|