Forums

How to create static content from form data

mlklocke 13 Feb, 2008
I want to create a submsission form for users to input project data and then have that data from that form become static content that can be accessed in joomla after you hit the submit button.

Is this remotely anything that chronoforms might be able to do?

I am open to ideas.

Thanks,

Michael Klocke<br><br>Post edited by: mlklocke, at: 2008/02/13 16:06
GreyHead 14 Feb, 2008
Hi Michael,

Yes I think so. I'm just not certain about 'static' data. Do you mewan that the data is displayed in a normal Joomla content page?

That can be done. Create two 'forms' in ChronoForms, one to collect the data and a second to display it (you can create a ChronoForms form using any PHP+MySQL+HTML - it doesn't need to have input fields and a submit button).

You can then use the ChronoForms mambot to embed the second form into a Joomla content page.

Bob
mlklocke 14 Feb, 2008
yes i do want to display the form data in a regular joomla page. But please bear with me as i am a newbie to this and dont know how to write php and mysql coding so i have no idea how to do the second form. I know how to use chronoforms to create the first form but have no idea what to do with the second form. how does the mambot figure into all of this as well. I hope i dont sound too stupid here;)
GreyHead 14 Feb, 2008
Hi Michael,

OK. Create your first form get it working and checked out then create a table in the ChronoForms Form Manager. If you then look at the AutoGenerated tab you'll see a bunch of fairly cryptic code. Please copy and paste that here (or email a Form Backup to me at the address in my sig) and we'll do the next step tomorrow.

Bob
tanko 01 Mar, 2008
Thanks, I have the same doubts. I'm no programmer and a begginer to Chrono Forms and I'm really interested on how to do this (show records on content).

I want to base almost a whole page on these record generated content and hope it's really possible for me. :blush:
GreyHead 01 Mar, 2008
Hi tanko,

It's not too difficult, just do the same as I asked Michael.

Bob
mlklocke 01 Mar, 2008
Sorry this has taken so long to get back to you on, but I ended up in the hospital and wasnt able to get you my code, but I am back now😉

Here is what I did:
I created a form in FrontPage and copied the form code to my test form named "recipe" in my chronoforms component and then save it. I then clicked on create table and selected the two fields I wanted saved. There are a total of 4 fields altogether but two of them are the submit and reset button. I then went in and copied the code from the auto-generated tab and have pasted it below.
<?php 
global $database;
	
$database->setQuery( "INSERT INTO #__chronoforms_4 VALUES  (
'' , '". date('Y-m-d')." - ".date("H:i:«»s"«»)."', '".$_SERVER['REMOTE_ADDR']."' , '".mosGetParam($_POST,'Recipe_Name','')."' , '".mosGetParam($_POST,'Recipe_Submitted','')."');" );
if (!$database->query()) {
echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>
";
}
?>
Now i guess the question is how does this get turned into content from here.

A couple of things I will mention. I do have community builder installed and I do see a CR Registration button in my chronoforms engine along with Joomla Registration and Profile Page which look new. Incidentally peopel will not be able to get to this form unless they have registered so i do want the CB registration to be used if possible to tag cb profile information to the form, if indeed that is even what that button is for. I havent quite figured it all out what that is for yet.

Cheers,

Michael<br><br>Post edited by: GreyHead, at: 2008/03/01 20:15
GreyHead 02 Mar, 2008
Hi Michael,

Sorry to hear you've been in hospital, trust all is well now.

To answer backwards: the Joomla Registration & CB Registration PlugIns allow you to register new members using a ChronoForms form so that probably aren't what you need here.

The Profile Plugin is more useful as it allows you to pull data from an existing Joomla database table like #__chronoforms_4

To display your data, create a new form. In the form HTML box write the HTML for your display page as usual but put {Recipe_name} and (Recipe_Submitted} where you want that data to show up. Save the form then select it in the forms manager and click the Profile Plugin icon and complete the forms. IIRC correctly it will ask you for the record id field and the names of the fields you want to read. Check the i tooltips for more info.

You can link into cb information - probably through the $my->id which will give you the Joomla user id of a logged in member, you can them look up the CB info. This needs a longer post than I have time for right now. Ask for more when you need it please.

Bob
mlklocke 02 Mar, 2008
Ok you lost me here. I created another form called RecipeContent. In your post you said:

The Profile Plugin is more useful as it allows you to pull data from an existing Joomla database table like #__chronoforms_4

To display your data, create a new form. In the form HTML box write the HTML for your display page as usual but put {Recipe_name} and (Recipe_Submitted} where you want that data to show up. Save the form then select it in the forms manager and click the Profile Plugin icon and complete the forms. IIRC correctly it will ask you for the record id field and the names of the fields you want to read. Check the i tooltips for more info



The parts i am not understanding are higlighted in red. am i supposed to still use the form box such as textbox to display the data or am i supposed to removed the text box and just put {Recipe_Name} and {Recipe_Submitted} in place of the form textbox.

Do you have documentation hiding somewhere on the site that would explain all this? I have looked thru the FAQ's and such and have found no user manual other how to create a form.:)
GreyHead 02 Mar, 2008
Hi Michael,

Sorry, this is all new and I'm one step ahead of you. The only documentation so far is in forum posts here.

The important piece to get in this is that ChronoForms is a way of displaying html on a Joomla page. It's usually used to create a form but doesn't have to be.

#__chronoforms_4 is a Joomla table name, except that the first #_ is replaced with a prefix, usually 'jos' . The Profile Plugin has a drop-down that will show you a list of the Joomla database tables - select the corresponding one probably jos_chronforms_4

You put your display code in the Form Code | HTML code box but you don't need to use 'form html'. Just plain ordinary html will do fine. In fact to test you can just write
Recipe name : {Recipe_Name}

{Recipe_submitted}
though you'll probably want to pretty it up a bit more than that.

Set the email validation, anti-spam etc to 'No' and create a page link which has a parameter and value at the end. Like index.php?com_chronocontact&chronoformname=recipes&recipe_id=1

You'll need to have put 'recipe_id' in the Profile Page form as the REQUEST Parameter name; and the database record id, probably 'cf_id' in the Target field name box.

Bob<br><br>Post edited by: GreyHead, at: 2008/03/01 23:41
mlklocke 02 Mar, 2008
Okay i tried what you said in your last post and the information is not coming back in the content page when i click on the link in the chronoforms component.

Here is what i am getting in the content page when i click the link in the chronocontact forms page

Recipe Name {name}
Recipe {recipe}

Its just showing the field names. i have the mambot published. i used recipe_id as the parameter in the profile manager and I used cf_id as the target.<br><br>Post edited by: mlklocke, at: 2008/03/02 07:27
GreyHead 02 Mar, 2008
Hi Michael,

Two possibilities - both my fault I think.

In the form you need to go to the PlugIns tab and check the Profile Page box to tell the form to use the PlugIn.

This form won't work correctly from the From Manager link because it needs to be called from a URL with the extra parameter i.e. &recipe_id=999 (or some valid recipe id). You can't have a static link to a dynamic page.

Do either or both of these do the trick?

Bob
mlklocke 02 Mar, 2008
Hello Bob,

They say genious comes to all of eventually one inch at a time! Thanks for the additional information. I was not seeing that at all as i was so focused on the Profile Manager button. The plugin tab was the key to the whole thing. Thank you so much.

Now i have one more question. I can now bring up the one recipe that i have. If i had a 1000 recipes how would i be able to just do something like click "next" to see the next one?:P

The way i have the content page done now is i created a static content page and i linked it to the user menu which can only be seen by registered users.
GreyHead 03 Mar, 2008
Hi Michael,

To have previous / next links (or any other kind of link) you can put in a text or image link of the same form as you used to see this page with a different recipe_id=nnn

If you have a continuous library then you can set:
<?php
$next_recipe = $_GET['recipe_id'] + 1;
?>
<a href='index.php?option=com_chronocontact&chronoformname=my_recipes&recipe_id=<?php echo $next_recipe; ?>' >Next recipe</a>
You'd probably make it prettier than that but basically that's it.

Bob

PS I imagine that you'll shortly want to do more complex things that require some custom database searches. Please come and ask when you do.
tanko 04 Mar, 2008
Hi! Thanks for your patience and support.

I was able to make a simple form and tried to follow Michael's steps for testing purposes. Created table, then created a new form where I pasted the code:

Recipe Name {name}
Recipe {recipe}

I'm sure I'm missing something ( not a surprise here B) ), because I can only get this code instead of the generated results.

Can't understand how both forms relate. Maybe I should have set more parameters apart from the basic form code? Like the field names? Sure I gave inputs similar names to the {} tag names, but I'm not sure if it was the right thing to do.

Also, plugin. If I don't have CB installed, I can't use plugins? (apart from the downloadeable mambot, I mean)

Sorry for being such a begginer. And thanks for the attention.
GreyHead 04 Mar, 2008
Hi tanko,

You can't use the CB PlugIn unless you have CB installed - the others are OK.

Sounds as though you haven't go the second form set up to use the plugin. Check back on messages #6206 & #6212.

Bob
Rrr 15 May, 2008
Hi

Okay I got this working and I'm thrilled to display on the same page what users have submitted in my form. It's great! But now what I want to do is output ALL the cf_id records (not just one) above my form.

I am making a For Sale page where users just type in their for sale item details and press submit and it get's added up above the form.

Any ideas on this?
Great fun thanks
GreyHead 15 May, 2008
Hi Rrr,

I think Max is working on a PlugIn that will show many records.

Or you can build your own. Write a database query to pull all the records that you want then display them with a foreach loop.

Bob
Rrr 06 Jun, 2008
so this loop I should put before or after the email?

I think it must be before because then the person sees all the For Sale items that others have put it.

Any news on Max and the plugin? I'd like to use your official plugin as it would be better.

(BTW this is not for profit, it's just a page for an Aust council employees)
GreyHead 06 Jun, 2008
Hi Rrr,

If you want it to show on the form page then put the code at the beginning of the Form HTML. You can put any code you like in there - well valid htm, php, etc

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