Forums

New Record acting like Edit Record

sendas 18 Feb, 2010
When I click on new record it is brining up my form but with data in it from one of my database table.

If I change the data, it doesn't add a new entry. It edits the entry that it pulled the data from.
GreyHead 18 Feb, 2010
Hi sendas,

No idea, sorry. Can you post a link?

Bob
sendas 22 Feb, 2010
I'll Pm you the info.
GreyHead 23 Feb, 2010
Hi sendas,

The error message you are now seeing has something to do with the site URLs which are a bit odd.

This gives an error:
{domain}/component/chronoconnectivity/index.php?option=com_chronoconnectivity&connectionname=FreeTrials

This is OK:
{domain}/component/chronoconnectivity/?connectionname=FreeTrials

Bob
sendas 24 Feb, 2010
Hi,

turned off all SEF links now Im at {mydomain}/index.php?option=com_chronoconnectivity&connectionname=FreeTrials

Still giving the same error
GreyHead 24 Feb, 2010
Hi sendas,

I still see
{domain}/component/chronoconnectivity/?connectionname=FreeTrials&task=newrecord
for the new record form.
Bob
sendas 24 Feb, 2010
I had to turn SEF links back on so customers wont get 404 on some pages.
bighen 10 May, 2012
Hi,
Replying for an old thread, cause it is the one that describes my problem very well.
I'm on CC 2.0 RC3 and forms of ChronoContact V3.2.
It was the same as described by sendas though I don't use any SEFs, the server is on intranet only.

After deep debugging I found that the problem is
in the class CFChronoForm in the body of the method getInstance:
	function &getInstance($formname = ''){
		static $instances;
		global $mainframe;
		if (!isset ($instances)) {
			$instances = array ();
		}


The variable $instances for some reason is static and stores static values.
And that's the reason I got filled in the form instead of empty for a new one.
For the experiment I commented out the static line, the values dissapeared but
storing the record did not work.

I don't want to move to recent versions.
Maybe this info would help someone to patch it or get some clue for the problem.

Henryk
bighen 10 May, 2012
The update:
The new record form was filled in because for smoe reason the id of the record structure was set with the id of the user logged in.
Until I used the scripts Public I mean without restricted access for registered users it was ok.
Als until my records were below the ids of the users everything was fine.
The buggy code is in cf_profile.php plugin starting from line 209:
		$parid 	= JRequest::getVar($params->get('parameter'));
        if ( $parid ) {
            $record_id = $parid;
		} else if ( $params->get('default_param_value') ) {
			$record_id = $params->get('default_param_value');
        } else {
            $record_id = $my->id;
            if ( $record_id == 0 ) {
                //$record_id = '##guest##';
            }
        }

For some reason line:

            $record_id = $my->id;

set the user id ($my is the user object) for the record id

I commented out the line and the problems gone however it could have side effects for forms used for user registration or something.

Might be helpful for someone...

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