Forums

how to make head or tail of it

daffy 23 Mar, 2010
OK that is a bit cheeky but I cannot see what Chronoconectivity is for.
I want to display one record from a database in a content page of my Joomla site, Allow the user to modify that record and automatically save it when he leaves the page. Is this the object of CC or something like it. (different records on different pages).

I can do it rather tediously using direct database techniques but if CC will do it that will save effort. I have read the one tut but that does not make clear where it is aiming.

Best REgards
Dave
GreyHead 23 Mar, 2010
Hi Dave,

For one record use a ChronoForm. If you want to display a table of many records use ChronoConnectivity.

Bob
daffy 23 Mar, 2010
Thanks Bob,
I will explore that possibility it looks like a steam hammer to crack a nut. I think my mind must work differently to most here but I will cogitate it for a day or two.
thanks again.
Dave
GreyHead 23 Mar, 2010
Hi Dave,

It actually works quite well - though there are some problems with complex queries.

Bob

. . . and then there's the Birmningham screwdriver - it all you have is a hammer then everything looks like a nail.
daffy 24 Mar, 2010
Thanks Bob the fact that staircases are buit with nails always amazes ne,
Now I have studied JTable.
I have a table called jos_1_products. and made an extension of JTable based on that.
Two of the variables added when making the extension are Var $pricecode = ''; and
var $quantity = 0; Setting the default values thereby.
I then do a construct of my jos_1_products. which looks fine. and do
$myrow = & JTable::getInstance("1_products"); which looks fine.

Then I do $myrow->load(3); expecting to get the row with id = 3
print_r($myrow); shows that $myrow is filled with exactly what I want as well as lots of other stuff.

If I then try to treat $myrow as an array I get my wrist slapped by Joomla with a stern error message. I gather that $myrow is an object and therefore expect it to have methods but cannot see any anything about this in Joomla docs.

So I examine the Chronoforms program and I see lines like:
"JRequest::setVar(cf_user_id,JRequest::getVar( "cf_user_id", $user->id, "post", "int", "")


I can see that setVar...getVar seems to be setting into the form what is obtained from the JTable?
But I cannot see how to put that into one of the form elements. and where does the "post" come into the process.

In other words yes.. use chronoforms for one row but how to display the existing value alter it if required and save the new value ??

Thanks for any explication.
--
Dave
GreyHead 24 Mar, 2010
Hi Dave,

I'm not quite sure what code you are using to get your wrist slapped.

You should be able to get the $myrow values with $myrow->name ($myrow['name'] won't work).

JRequest is a different object that accesses the PHP $_REQUEST arrays (post, get, & cookie variables) not info from a table.

I'm not sure if you get back an extended table object or a new standard boject :-(

Either way it probably has the standard get & set methods: usually $myrow->get('name', 'default_value'); and $myrow->set('name', 'value');

Bob
daffy 25 Mar, 2010
Thanks again Bob you are right of course.
I tried every combination except the right one!
Now I can see how to easily get data from the database into a chronoform in the first place and hence, on submit, return it to the database, altered of otherwise. Now I cannot spare the space that a chronoform takes up so I have to find out how to make it tighter by altering the CSS. I willsearch the chronoform forum.

Thanks again
--
Dave
This topic is locked and no more replies can be posted.