Forums

PHP Notice: Undefined variable: omittedlist in

nervosud 29 Apr, 2008
Hi.
When i try to send the form i've this message:

"PHP Notice: Undefined variable: omittedlist in C:\Inetpub\wwwroot\aaa\components\com_chronocontact\chronocontact.php on line 378 PHP Notice: Undefined property: stdClass::$name in C:\Inetpub\wwwroot\aaa\components\com_chronocontact\chronocontact.php on line 389 PHP Notice: Undefined property: stdClass::$email in C:\Inetpub\wwwroot\aaa\components\com_chronocontact\chronocontact.php on line 389 PHP Notice: Undefined property: stdClass::$submit in C:\Inetpub\wwwroot\aaa\components\com_chronocontact\chronocontact.php on line 389"



Can you help me? Please!!
GreyHead 29 Apr, 2008
Hi nervosud,

These are PHP notices about things that 'might' cause a problem. Usually you can turn them off by setting 'Error Reporting' to 'System Default' in your site Global Configuration.

Bob
H13 29 May, 2008
just add element titles, e.g.:

name=Name

and fill something into a:
General - Omitted fields names

e.g. 'Nothing' there must be some value to not display the notice...

Jan
GreyHead 29 May, 2008
Hi Jan,

The problem with Error messages is that PHP5 issues warnings and notices about undeclared variables; and ChronoForms in effect creates a new set of variables from the form field names.

Max really neeeds to put in a few lines of code to predeclare them and avoid the messages but it's not in the releases so far.

It's easy enough to code around if you know a little PHP but hard to explain to users who don't know any.

Have you hit a problem with this? If so, post the error caode and I'll give you a fix for it.

Bob

PS Congratualtions on PhocaGallery, it's an excellent extension. I've just been installing a version this week.
H13 29 May, 2008
Thank you....

I got the same errors as nervosud get. But if I added the items I have wrote, no errors are displayed now, so if nervosud add:

e.g. value 'Nothing' into Omitted field, the variable will be filled (notice will be not displayed)

If he add into elements titles, e.g.:

name=Name

the $name variable will be exist and no notice will be displayed...


One question: is there a possibility to validate the form on server side ?
Thank you, Jan
GreyHead 30 May, 2008
Hi Jan,

Thanks for that.

You an validate the form on the Server side, but there's nothing provided 'out of the box'.

You can create your own validation code in the 'OnSubmit before' box then return to the form with
showform($_POST);
For this to re-show the input values correctly the form must have the $_POST array variables as the input values e.g.
<input name='email" type="text" value="<?php echo $_POST['email']; ?> />
Bob
H13 30 May, 2008
great, thank you.

Jan
H13 30 May, 2008
maybe this will disable the notices (for me it works), Jan

chronocontact.php, row 341 +

$fields = array();
foreach ( $names as $name ) {
  if (isset($_POST[$name])) {
    if (is_array($_POST[$name])) {
      $fields[$name] = implode(", ", $_POST[$name]);
    } else {
      $fields[$name] = $_POST[$name];
    }
  } else {
    $fields[$name] = '';
  }
}
GreyHead 30 May, 2008
Hi Jan,

Looks good to me, I call a function that does something similar:
/**
 * If the submitted variable is an array 
 * convert it into a string
 * If it's not set then set it
 *
 * @param unknown_type $var
 * @return string
 */
function preSave($var) {
    if ( isset( $var ) ) {
        if ( is_array( $var ) ) {
            $var = implode( ',', $var );
        }
    } else {
        $var = "";
    }
    return $var;
}
Bob
H13 30 May, 2008
great to hear it...

BTW: the ChronoForms component is great and powerfull, I will vote for it...

thank you, Jan
sock2me 24 Jun, 2008
Hmmm...
I'm not sure I understand. I added Entries into those fields that were suggested here but I am still getting this error:

Notice: Undefined property: stdClass::$name in C:\joomla\components\com_chronocontact\chronocontact.php on line 364

Notice: Undefined property: stdClass::$title in C:\joomla\components\com_chronocontact\chronocontact.php on line 364

Notice: Undefined property: stdClass::$suggestion in C:\joomla\components\com_chronocontact\chronocontact.php on line 364

Notice: Undefined property: stdClass::$button in C:\joomla\components\com_chronocontact\chronocontact.php on line 364
GreyHead 25 Jun, 2008
Hi sock2me,

These are PHP warnings, you can fix them by adding some code but the simplest way is usually to go to your Joomla Global Config and set error reporting to System Default (or something lower than Maximum).

Bob
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount

{item:title} {images:#}