Forums

register/subscribe to different groups/event/subjects

juanpablo 23 Dec, 2008
Hello to all,

I plan to use chronoforms for the following scenario.

There are four different subjects/classes that are linked to their respective menu entry.
A,B,C,D different subjects/classes and menu entries.
The interested person is able to apply for one or more of the subjects.
So I plan to create for each subject a form where the interested person can subscribe with his name and his email.

The idea is to create four new tables through phpmyadmin and four forms that save entered data of the interested person in the correct table.

My question is, is it a good idea to stick at this solution and to solve it with chronoforms?

For any hint or advise i would be thankful.
cheers,
JP
GreyHead 23 Dec, 2008
Hi JuanPablo,

You can certainly do this with ChronoForms.

I would do it slightly differently and use one database table and one form for all four subjects. You need an extra column in the table to record the subject.

If you create the menu links to include subject ids like . . .&subject=04 then you can use a PHP switch statement in the form code to show the appropriate form code.
<?php
$subject = JRequest::getString('subject', '');
switch ($subject) {
  case '01':
    // show form for subject 01
    break;
  case '02':
    // show form for subject 02
    break;
  . . .
}
?>
In praactice I suspect that much of the form would be the same and could be shown in every case.

The advantages of this approach are that you only have one form to maintain and you have all the data in a single database so that you can sort and display it more easily.

Bob
juanpablo 23 Dec, 2008
wow! this goes fast her.

thank you for your effective solution. i will try this way than. didn't knew that it's possible to integrate php code in such an easy way😀 .
cheers,
jp.
juanpablo 24 Dec, 2008
Hi Bob,

I finally managed to create, and input data to the database and also played a little bit with putting php code through the Chrono Forms Manager -> Form Code Tab -> Html Form.

There I have injected the following code in blue
<?php 
$foo = JRequest::getInt('Id', '');
$bar = " pleas work";
?>//her stops my code
<div  class="form_item">
<div class="form_element cf_heading"><h1 id="" class="cf_text"><?php echo $foo,$bar;?>Kurs</h1></div><div class="clear"> </div></div><div  class="form_item">


My problem her is how to get the itemid of the menu link so I can use a switch statement. With the function JRequest::getInt('Id', ''); I get value of 0. Which is obvious cause it tries to get the itemid of the chronoform which doesn't have.

Or to do it your way. But there I have some questions:

If you create the menu links to include subject ids like . . .&subject=04 then you can use a PHP switch statement in the form code to show the appropriate form code.



My menu link looks like this
http://www.realentertainment.de/index.php?option=com_content&view=article&id=18&Itemid=26
and how can you put an anditional parameter to the link like &subject and how can you get the value? Or wouldn't be sufficient to get some how the itemid???

Sorry for this silly question. As you note I'm just starting with php and joomla and maybe it's not the right place to post this subject. But I spent all night on this. I'm eager to learn.

And another question how do you test your little php-code snippets. The way I'm doing it at the moment is Chrono Forms Manager -> Form Code Tab -> Html Form add some code save and then refresh page. It works quite good but would be nicer to have a quicker method. Because after saving I have to drive through all menu elements again.

btw I wish you merry Christmas,
cheers,
jp
GreyHead 24 Dec, 2008
Hi JuanPablo,

You probably don't want to use the ItemId as it can change with your Joomla setup - or if you add the same form to second menu.

You can create menu items of the type 'External URL' and simply add the extra code on the end of the URL.

I test my code snippets much like you do (when I test them that is). I have two browser windows open, one has the Admin where I edit and 'Apply' and the other has the form open where I just click 're-load'.

For more complicated projects I do something a little different. I move the main code outside ChronoForms so that I can edit with a 'proper' editor instead of the little textarea windows.

I add a folder com_chronoforms/includes/my_form and put files in this like formhtml.php then in the formhtml box I just put
<?php
require_once JPATH_BASE . DS . 'components' . DS . 'com_chronocontact' . DS . 'includes' . DS . 'myform' . DS .'formhtml.php';
?>
so that the external file is included on execution.

This lets me edit the file with FTP - I use an Eclipse PHP editor, save the file and refresh the form. It's even simpler than using 'Apply' as the form window stays open.

There are some draw-backs - ChronoForms can't 'see' the Form HTML so you can't, for example, use {imageverification} but those things are easy enough to work around.

Bob
juanpablo 24 Dec, 2008
okay, I'm a little bit further
i created a menu Item so that the form has an id and with
JRequest::getInt( 'Itemid');

i can get the id
juanpablo 27 Dec, 2008
Hello,

me again.

@Bob, thanks a lot for your help, it`s now nearly working as you said. The solution with eclipse sounds good. I'll try it when I'm a little bit more in this stuff.

I still stick to the following problem.

This code snipped works fine. When I switch between the curs types it automatically fetches the attribute value kurs=01, kurs=02, etc. as Bob explained me to do.

<div  class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Curs Type: <?php $kurs = JRequest::getString('kurs', ''); echo $kurs;?></h1></div><div class="clear"> </div></div>


Now I want of course that this Attribute value, $kurs=01, that describes the selected curs is also written into the database table kurs_db in row kurs. the other three elements are written properly to db: text_1, text_2 etc.
Which attribute is necessary or which tag? I now that the php tag has to be embedded in a tag but which one? I tried to use the <input id="kurs" name="kurs"> tag but it wont work. It displays me a new textentrybox.

Can anyone give me a hint?
I would appreciate a lot.
thx in advance.

JP
GreyHead 27 Dec, 2008
Hi JuanPablo,

Use a hidden field in your form:
<input type='hidden' name='kurs' value='<?php echo $kurs; ?>' />


Bob
juanpablo 28 Dec, 2008
Hi Bob,

thanks again for your precise help.

Now I have maybe stupid question, but I don't realize why to use a switch statement. Okay, I will have only one form with one table. At the moment I have four forms for 4 different curses and one table. Does not the switch statement method take a little bit more processing time. Well I'haven't try it.

JP
GreyHead 28 Dec, 2008
Hi JuanPablo,

Well yes, it will take a few milliseconds more - but nothing that you will notice. The real difference in time is when you need to make a change, or to produce a report, and you only have one form to deal with and not four.

The basic rule I (try to) follow is to get the computer to do as much work as possible and keep my life as simple as possible :-)

Bob
juanpablo 30 Dec, 2008
@bob,

to get the computer to do as much work as possible and keep my life as simple as possible :-)



jep, that's true. thanks for your advice.

Now I`m facing a problem that for sure has already been discussed several times but I can't find it 😟 .
I used the search with the following therms but with no success.
duplicate entries, write to db, handling mysql output, catching, fatching mysql errors, etc...

Well, what I try to do now is that the interested user can register his self only for one curse/subject/event.
To avoid that the same date is going to be stored in db I set the fields 'email' and 'name' as unique. so if someone registers to an curs/subject/event where he is already registered mysql will return the following error:

Tablechronoforms_kurs_db::store failed - Duplicate entry 


Which is perfect. Now I want of course that there is no mail going out to the user because he/she his already registered.
I know I have to put some php code snipped in the On Submit code - before sending email: section but what exactly and which technique is better. And how to say to the email not going out.

1.Technique: use error message of mysql. but how to access to it. Which I think is the effective one.
2. Technique: read db field and compare it with $_POST['fieldname'] ...better not.

thx for any advice in advance,
cheers,
JP.
Max_admin 30 Dec, 2008
Hi Juan,

Whats the primary key of this table ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 30 Dec, 2008
Hi Max,

there it is
primary key: cf_id, extra: auto_increment
unique: text_3, kus

...why you need this info?

JP
GreyHead 30 Dec, 2008
Hi Juan Pablo,

If these are registered users then check their registrations in the Form HTML *before* you display the form so that they don't see choices that aren't valid.

If you have to check after the event then $db->getNumRows() will be zero if there have been no changes and 1 if they've been registered - you cna use this to set up the logic you need to control the e-mails.

You might want to send them an email saying that they are already registered (or that their registration failed).

Bob

PS 'curse' => maldición; 'course' => curso. It's a 'false friend' => falso amigo
juanpablo 30 Dec, 2008
Hi Bob,

the users are not registrated. they only are capable to put their name, email, and course choice into a table.
So I was trying to use it with your command $db->getNumRows().

And her I have the problem that I don't know how to use it. I tried in the On Submit code - after sending email: sections to put this code:
<p>PHP output her <?php echo $db_real->getNumRows(); ?>.</p>

only to test the function getNumRows()
I don't get nothing back and the funny thing is if I change it for example to <?php echo "test"; ?>.</p> the output works without problems. This means it shows me the whole information within the content frame, debug mode and duplicate error in red and so on.
but when I try the other version it returns me the result in the whole browser. that means without menu, etc...

any ideas?!
cheers,
JP
Max_admin 31 Dec, 2008
Hi JP,

Show me your autogenerated code of the form please!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 02 Jan, 2009
Hello to all again and happy new year.

After reading and searching a lot I didn't come to a solution to the problem mentioned above.

Here is a code snipped which I found her somewhere in the forum.



<?php
$database = &JFactory::getDBO(); // only needed once
$query = "SELECT *
FROM `jos_chronoforms_kurs_db`
WHERE 1
LIMIT 0 , 30";
$database->setQuery( $query );
$rows = $database->loadObjectList(); 
$count = $database->getNumRows( $rows );
echo "count: $count<br />";
?>


The output of this code is only count and than nothing not even 0

I don't know what to do. It seems that the function getNumRows doesn't work.
For any advice or maybe an other approach I would be very thankful.
juanpablo 02 Jan, 2009
...oops! sorry, didn't see your post.

here is the auogenerated code

<?php
		if($paramsvalues->dbconnection == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("chronoforms_kurs_db", "Table");
			srand((double)microtime()*10000);
			$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16);
			JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
			JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
			JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
			JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
			$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );			
			if (!$row->bind( $post )) {
				JError::raiseWarning(100, $row->getError());
			}				
			if (!$row->store()) {
				JError::raiseWarning(100, $row->getError());
			}
			global $row_jos_chronoforms_kurs_db;
			$row_jos_chronoforms_kurs_db = $row;
		}
		?>
GreyHead 02 Jan, 2009
Hi JuanPablo,

I'm getting confused here.

A) The code snippet you posted is full of errors: WHERE 1 doesn't mean anything and getNumRows doesn't take any parameters.

B) In an earlier post: you can't check getNumRows on it's own it returns the number of rows affected by the last MySQL query so you must check it immediately after a query.

C) I'm not sure how the AutoGenerated code helps either . . .

Try this in the OnSubmit After box
<?php
$email = trim(JRequest::getString('email', '', 'post'));
$db = &JFactory::getDBO();
$query = "SELECT COUNT (*) 
    FROM `#__chronoforms_kurs_db`
        WHERE  email = $db->quote($email);";
$db->setQuery( $query );
$count = $db->loadResult();
echo "count:  $count <br />";
?>

Bob
juanpablo 03 Jan, 2009
Hi Bob,

first of all I want to thank you again for your help and patient.

I tried your code, as it is, but with no success.
Don't know if it's the way to do it but to test the single lines I put a line to display me what e.g.
<?php
$email = trim(JRequest::getString('email', '', 'post'));
echo "show me mail: $email <br />";
?>
returns me. And her it returns me nothing only the String "show me mail:" without the variable $email. How can I figure out which values are holding the variables? In this case there should be an output, or I'm wrong?

regards,
JP
GreyHead 03 Jan, 2009
Hi Juan Pablo,

I'm not sure if a bit has been lost in the pasting but the code needs to be
<?php
$email = trim(JRequest::getString('email', '', 'post'));
echo "show me mail: $email <br />";
?>
No need to repeat the <?php tags if they are already there.

Bob
juanpablo 03 Jan, 2009
... i did it exactly as you posted. I was just changing my post 🙂.
but still not returning value of variable $email

and I tried to put the code snipped in both sections, On Submit code - before sending email: On Submit code - after sending email:
same result.

Cannot figure out why. Maybe any settings?!
juanpablo 03 Jan, 2009
sorry, my fault. in my case my variable is text_3 for email. now the output works.
damn, it makes me crazy so stupid mistakes.
GreyHead 03 Jan, 2009
Hi JuanPablo,

Great - no problem with the mistakes, it's just learning . . .

Bob
juanpablo 03 Jan, 2009
... so, now I'm getting a little bit further.
I have this code snipped which returns me the number of entries of table _kurs_db and it works fine.

<?php
$email = trim(JRequest::getString('text_3', '', 'post'));
echo "show mail: $email <br />";
$db = &JFactory::getDBO();
$query = 'SELECT count(*) FROM `jos_chronoforms_kurs_db`';
$db->setQuery( $query );
$count = $db->loadResult();
echo "count:  $count <br />";
?>


As I mentioned somewhere earlier I would like to check first if the interested person has already an entry in table _kurs_db.
The solutions that I have found or recommended by Bob here summarized.

1.Do it with getNumRows()

If you have to check after the event then $db->getNumRows() will be zero if there have been no changes and 1 if they've been registered - you cna use this to set up the logic you need to control the e-mails.



Could not manage to do it this way. The http://help.joomla.org/index.php?option=com_content&task=view&id=531&Itemid=60 tells me that I can use it without parameter but directly after a query.
So I added the echo "row successfully changed: $db->getNumRows(); <br />" ; directly after the query but still no out put. maybe to pass the object $resource parameter?!

<?php
$email = trim(JRequest::getString('text_3', '', 'post'));
echo "show mail: $email <br />";
$db = &JFactory::getDBO();
$query = 'SELECT cf_id FROM `jos_chronoforms_kurs_db`';
$db->setQuery( $query );
echo "row successfully changed: $db->getNumRows(); <br />" ;
$count = $db->loadResult();
echo "count:  $count <br />";
?> 


2.Solution to do it with an query which compares all entries of field text_3 (email) with the email which was just entered.

3.Solution: use db SQL error: Tablechronoforms_kurs_db::store failed - Duplicate entry which I prefer but don't know how to use the database->getErrorMsg which I found in the API here: http://help.joomla.org/index.php?option=com_content&task=view&id=520&Itemid=60

regards,
JP
GreyHead 03 Jan, 2009
Hi Juan Pablo,

Use the SELECT count (*) snippet with a WHERE clause.
<?php
$email = trim(JRequest::getString('text_3', '', 'post'));
echo "show mail: $email <br />";
$db = &JFactory::getDBO();
$query = '
    SELECT count(*) 
        FROM `#__chronoforms_kurs_db`
        WHERE email = $db->quote($email);';
$db->setQuery( $query );
$count = $db->loadResult();
echo "count:  $count <br />";
?>

Bob

PS $db->getNumRows will only have a value *after* the query is run so that code would need to be
. . . 
$db->setQuery( $query );
$count = $db->loadResult(); // <-- query runs here
echo "row successfully changed: $db->getNumRows(); <br />" ;
echo "count:  $count <br />";
. . .
juanpablo 03 Jan, 2009
...hmm! still no output at all with this code snipped $db->getNumRows();.

. . .
$db->setQuery( $query );
$count = $db->loadResult(); // <-- query runs here
echo "row successfully changed: $db->getNumRows(); <br />" ;
echo "count:  $count <br />";
. . .


I will do it now with the compare method, and when everything works I will try to optimize it with the errorMessage.

Now my question is, where and how to put code that does the following:
check if entry already in databank, than don't send a email, display: "you are already registered for this subject"

Suppose that this pseudo code has to go into the section before sending email, but which parameter, function to use to control the sending and not sending functions.

?php
$email = trim(JRequest::getString('text_3', '', 'post'));
echo "show mail: $email <br />";
$db = &JFactory::getDBO();
$query = '
    SELECT count(*)
        FROM `#__chronoforms_kurs_db`
        WHERE email = $db->quote($email);';
$db->setQuery( $query );
$count = $db->loadResult();
// if count has more than one entry, that means he is already registered
if ($count > 0)
echo "entry already in table"; //breake?? or stop or how to say don't send mai???
else
sent mail; 

echo "count:  $count <br />";
?>


regards,
JP
Max_admin 04 Jan, 2009
Hi JP,

Replying to your last question, you can set $emails[0]->enabled = 0 or 1 and this will disable or enable the first email you created in the "email setup" tab! use it in your code at the onSubmit before email box!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 05 Jan, 2009
@max, thx. will try it out when I get there.

now I'm stuck at the comparison in the sql query.
the variable $email holds the email which the interested person puts in the form.
The field text_3 contains the emails which are already inserted in table _kurs_db.
I want to make a comparison with the fresh email of the form and the emails already inserted in table.

I tried it with the following code:

<?php
$email = trim(JRequest::getString('text_3', '', 'post'));
echo "show mail: $email <br />";                                          // it returns me for e.g. joomla.rosas[at]googlemail.com
$db = &JFactory::getDBO();
$email = $db->Quote( $email );                                            
echo "show mail: $email <br />";                                          // after using the quote function it returns me  'joomla.rosas[at]googlemail.com' the string returned is surrounded by single quotes.
$query = 'SELECT text_3 FROM `jos_chronoforms_kurs_db` WHERE text_3 = $email ';
$db->setQuery( $query );
$print = $db->loadResultArray( 0 );
print_r ($print);
echo "show mail: $email <br />";
#echo "count:  $count <br />";
?>  


well I don't know how to pass the $email variable to the query correctly. because when for e.g I replace "$email" for "joomla.rosas[at]googlemail.com" then it works fine and the output is:
Array ( [0] => joomla.rosas[at]googlemail.com [1] => joomla.rosas[at]googlemail.com [2] => joomla.rosas[at]googlemail.com ) show mail: joomla.rosas[at]googlemail.com

I have try it also with the function getEscaped function and than replaced the ...WHERE text_3 = "$email" but also with no success.

what I'm doing wrong and why I cant use the $email in the sql query as it is???

regards,
JP.
juanpablo 05 Jan, 2009
...okay, I found the error.
I was generating my sql Queries with myPhpAdmin. Once the query is as wished, you can click on the button "generate php query" and this I copied into the $query = ....

Generated code:

$query = 'SELECT text_3 FROM `jos_chronoforms_kurs_db` WHERE text_3 = $email ';
$db->setQuery( $query );


Problem was that the generated query is encapsulated in single quote and the function Query generates also single quote.

so I changed the query to

$query = "SELECT text_3 FROM `jos_chronoforms_kurs_db` WHERE text_3 = $email ";
$db->setQuery( $query );


and know it works 🙂
GreyHead 05 Jan, 2009
Hi JuanPablo,

Great - I'm glad you fixed this. Good find.

The difference is a PHP one - in a string with 'single quotes' the embedded php code is *not* evaluated so $email was being treated as a string and not replaced by the 'correct' email.

Bob
juanpablo 05 Jan, 2009
... anybody knows where to deactivate the following MySQL error message on red background?
Tablechronoforms_kurs_db::store failed - Duplicate entry ...

I thought it was part of the debug mode. But after deactivating, it still appears. Of course the debug messages of chronoform which are on blue background are gone.

regards,
Fred.
GreyHead 05 Jan, 2009
Hi Fred,

That's a Joomla error message because the table entry hasn't saved properly. You'll need to debug to see what's causing the duplicate entries.

Bob
Max_admin 05 Jan, 2009
Hi JP,

Does your table have a primary key field and is it auto_increment ?

Regards

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max_admin 06 Jan, 2009
Hi JP.,

this error:
Tablechronoforms_kurs_db::store failed - Duplicate entry 

may mean that the row which is being saved has a primary key field value equals another existing row!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 07 Jan, 2009
Hi Max,

the error is okay. it is because of the unique keys so that an interested person can only register ones. I set two fields, email and name as one unique key and therefore the error. I think I will have to switch off somewhere mySQL that the message are not going to be displayed.

cheers,
JP
juanpablo 18 Jan, 2009
Hello to all again,

well, I'm just about to get everything to work as I wish.

But there is still a part that I would like to improve.

I'm still at the same Subject-Scenario as mentioned above. I thought it is easier for interested users to have a form where they can register to all Subjects, or to only one, or to two if they wish inside one form.

The Idea:
create a form with checkbox's, the users can check the subjects he wants to participate.

The Problem:
User himself has already register for a subject, e.g. subject A. After, two days later he decides to join subject B,C,F for example. If he registers again, the db_table will have a duplicate entry for field name, and email.

Solution???
It would be nice if it is possible to check first the entries in db_table before inserting the data.
For example:
If (email = text_3) //text_3 field for email in db_table and is unique
than if (checkbox_subject_boolean = tb_subject),
do not put entr
else put entry

Where can I do this? I suppose these can be done in the extra code tab.

Or maybe better to create for each subject one table and to link them with email as primary key. But then how to connect one form to several tables, is this possible?

Or has someone a better approach to this problem?

Regards,
JP

P.S: I've documented the basic steps of solution of this scenario as an how to. where can I post it? It's still in german but I'm doing it also in english?
GreyHead 18 Jan, 2009
Hi JuanPablo,

This can certainly be done in ChronoForms - though you are starting to 'push the boundaries' a little.

You need to be able to identify your users. Ideally you do this by having them register and log in; if this isn't practical then you can set a cookie; and you can run a check on their email after they do a form submission.

Once you know who they are you can pull up their current class bookings and show them easily enough together with a list of classes which they could still sign up for. Typically this kind of application has several tables that you look up - probably one for each of users, classes and 'users+classes' i.e. class registrations.

You can connect one form to as many tables as you like - but you will need to write much of the code to do the reading and writing yourself. ChronoForms automatic table links will be of limited use. (It's possible that ChronoConnectivity might be of more use here - or maybe a combination of the two.)

Bob

PS By all means post your German notes in the forums here - perhaps adding a Google translation would help (a little) those of us whose German is a little rusty.
juanpablo 19 Jan, 2009
Hi Bob,

I already use ChronoConnectivity to show my results. It's a really nice component. Very easy to use 😀 .

Thank you again for your suggestion. I'm taking to much time into that problem for the end result that has to be.
Maybe it's better to leave it like this and to send or show a notification e.g. if some interested users which is already registered in the table tries to submit for a new subject but cannot (because field name is set as unique). Then it will be display a message that says something like: "Please, sent a mail to blabla if you want to register or change any registrations".
Since there wont be to many people (hope so ^^).

Or what do you think of solving this issue with the UPDATE mySQL statement.

This code in the chronoform - formmanager -> form code tab -> on submit code before sending email


<?php
$email = trim(JRequest::getString('text_3', '', 'post'));
$db = &JFactory::getDBO();
$email = $db->Quote( $email );
$query = "SELECT COUNT(text_3) COUNT FROM `jos_chronoforms_anmelde_formular` WHERE text_3 = $email ";
$db->setQuery( $query );
$count = $db->loadResult();
if ($count > 0) {
  echo "Entry already exists, no email-> display message ";
  $emails[0]->enabled = 0;
} else {
  echo "You receive an confirmation email ";
  $emails[0]->enabled = 1;
}
?>


Here is my question:
Is it possible to use an UPDATE statement in the "if" part of the code? Something like

if ($count > 0) {
echo "Entry already exists, no email-> display message ";
$emails[0]->enabled = 0;
$query = "UPDATE field_1= "text_1" ...FROM table_name ...and so on
...

If this is a way, than I would have a table with one row for each interested person and his desired subjects.

Regards,
JP
Max_admin 21 Jan, 2009
Hi JP,

Here is my question:
Is it possible to use an UPDATE statement in the "if" part of the code?



why not ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 23 Jan, 2009
it works perfect with the Update method her my code snipped:

<?php
$email = trim(JRequest::getString('text_3', '', 'post'));
$AG1 = trim(JRequest::getString('AG1', '', 'post'));
$AG2 = trim(JRequest::getString('AG2', '', 'post'));
$AG3 = trim(JRequest::getString('AG3', '', 'post'));
$AG4 = trim(JRequest::getString('AG4', '', 'post'));
$AG5 = trim(JRequest::getString('AG5', '', 'post'));
$AG6 = trim(JRequest::getString('AG6', '', 'post'));
$AG7 = trim(JRequest::getString('AG7', '', 'post'));
$AG8 = trim(JRequest::getString('AG8', '', 'post'));
$AG9 = trim(JRequest::getString('AG9', '', 'post'));
$db = &JFactory::getDBO();
$email = $db->Quote( $email );
$AG1 = $db->Quote( $AG1 );
$AG2 = $db->Quote( $AG2 );
$AG3 = $db->Quote( $AG3 );
$AG4 = $db->Quote( $AG4 );
$AG5 = $db->Quote( $AG5 );
$AG6 = $db->Quote( $AG6 );
$AG7 = $db->Quote( $AG7 );
$AG8 = $db->Quote( $AG8 );
$AG9 = $db->Quote( $AG9 );
//echo "show AG1 ja oder nein: $AG1 <br />";
//echo "show mail: $email <br />";
$query = "SELECT COUNT(text_3) FROM `jos_chronoforms_anmelde_formular` WHERE text_3 = $email ";
$db->setQuery( $query );
$count = $db->loadResult();
//echo "count:  $count <br />";
if ($count > 0) {
  echo "Eintrag kommt mindestens einmal vor, also keine email <br/>";
$query = "UPDATE `jos_chronoforms_anmelde_formular` SET `AG1` = $AG1 ,
`AG2` = $AG2 ,
`AG3` = $AG3 ,
`AG4` = $AG4 ,
`AG5` = $AG5 ,
`AG6` = $AG6 ,
`AG7` = $AG7 ,
`AG8` = $AG8 ,
`AG9` = $AG9 WHERE `text_3` =$email LIMIT 1 ; ";
$db->setQuery( $query );
$count = $db->loadResult();
echo "count:  $count <br />";
  $emails[0]->enabled = 0;
} else {
  echo "war noch nicht eingetragen, sie haben eine email erhalten";
  $emails[0]->enabled = 1;
}
?>


Thank you very much for all the support.

I still have a little thing that disturbs me. Maybe someone knows where to turn of the mySQL duplicate entry message.
Or where to change the code that the red box with the duplicate error is not going to be displayed after submitting.
Debug is turned off and as I mentioned above it's on purpose because I do not want to have duplicate entries. When the entry already exists in the table then we perform an UPDATE.

Regards,
JP
Max_admin 23 Jan, 2009
Hi JP, do you enable DB connection ? if yes then try to disable it ? I can't remember if we used it before here or not...

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 24 Jan, 2009
Hi Max,

yes I use it. And I think I have to. Because I use it to store the information which the interested person puts in the from.

Regards,
JP
Max_admin 25 Jan, 2009
Hi JP, try to disable it, the error goes away ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 27 Jan, 2009
Hi Max,
sorry for the late replay.

The error-message on red backgroud:
Tablechronoforms_anmelde_formular::store failed - Duplicate entry 'frosas@informatik.uni-leipzig.de' for key 2 SQL=INSERT INTO `jos_chronoforms_anmelde_formular` ( `uid`,`recordtime`,`ipaddress`,`cf_user_id`,`text_1`,`text_2`,`text_3`,`AG1`,`AG9` ) VALUES ( 'INTI1Yjg2NTU2MTBi','2009-01-27 - 09:21:11','139.18.118.19','62','fred','red','frosas@informatik.uni-leipzig.de','AG1','AG9' )


disappears after disabling Data storage but than there will be no entry in Database Table "jos_chronoforms_anmelde" when some one wants to register to a subject.

I hope I understood you well. You are talking about these settings, don't you?
ChronoForms - forms manager -> DB Connection -> Enable Data storage set to NO

Regards,
JP
GreyHead 27 Jan, 2009
Hi Juan Pablo,

The error usually means you already have a database record with id =2 (where id is the primary index). This can happen because you/ve manually edited the table, or more often because the index isn't set to auto-increment.

Sorry this is a bit techie.

Bob
Max_admin 27 Jan, 2009
Hi JP,

If I understand you well then you are enabling the DB connection to let teh form insert new records AND you have also another piece of code to update those records at somewhere else ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 19 Mar, 2009
Hello,

well here is my notes that I took. Unfortunately in german. Wanted to translate it but at this moment I'm really short on time.
I hope it helps someone. It's more like an summery of the whole post above.It describes how to create a registration form.
Appropriate scenarios could be:
A conference offers many workshops. The interested person is able to register himself through the form. The manager of the workshop can approximate how many people will come to the workshop. He has a list of participants which he can view, edit, delete and add new records.


Formbulider/Formulare erzeugen

Anforderung:

* Nutzer sollen sich für einen Kurs in eine Liste eintragen/anmelden können
* Diese Liste soll dann nur dem "special" user sichtbar gemacht werden
* Manager/Kursleiter soll über das Backend neue Einträge vornehmen können. Diese löschen oder vorhandenen bearbeiten.

Recherche:

* Chronoforms
* Artforms
* Fabrik
* FacilForms gibt es nicht für Joomla 1.5 -> Nachfolger BreezingForms (kommerzielles Produkt) $$$
* RSFrom (kommerzielles Produkt) $$$

Chronoforms:

Quelle: chronoforms

1. Component chronoforms V3.0 stable Version installieren
2. Installieren von Chronocontact Modul (weiß zwar noch nicht was es so richtig kann)
3. Installation von Chrono Connectivity 1.2: Formulare erstellen, die Datenbank ergebnisse zurückgeben
Tutorial zu Chrono Connectivity


Ein Anmeldeformular erstellen:

Wir befinden uns im Backend:

1. Menu->Components->Chrono Forms->Form Wizard
2. Design your Form:
* Heading
* Textbox Name
* Textbox Nachname
* Textbox Email
* Heading
* Checkbox für AG
* Image Erkennung gegen Attacks
* Anmelde Button
Links oben auf das Symbol zum abspeichern klicken und einen eindeutigen Namen geben.
3. ChronoForms-Forms Manager: sich vergewissern, dass das ersteltte Formular published ist.
4. Wurde ImageVerification eingebaut, diese dann auch aktivieren unter AntiSpam.

DB Tabelle erstellen und anbinden

1. Wähle die Form aus und klicke oben links auf "Create Table".
2. Alle Felder auswählen, die noch kein Häkchen haben und dann auf "Save Table" klicken.
3. Nach der Meldung Table "Table Created Succesfully" Verbindung zur Tabelle herstellen. Wähle das Formular aus.
4. Wähle Reiter DB Connections. Setze "Enable Data Storage" auf yes, wähle die gerade erstellte Tabelle aus und abspeichern.
5. Kurz Testen. Über den Link anklicken, Form ausfüllen, Button "Anmeldung" klicken, zurück ins Backend und über LinkTableConnected Spalte in die Tabelle einsehen.

Formular und Tabelle mit weiteren Feldern erweitern

1. Formular mit gewünschtem Feld erweitern. Z.B. Textfield, checkbox, etc.
2. Über phpMyAdmin Tabelle erweitern, d.h. neues Feld hinzufügen
3. Komponenten -> ChronoForms -> Form Management, dann Formular wählen und auf den Reiter Form Code gehen. On Submit code - before sending email die nötigen Änderungen vornehmen, da hier festgelegt wird was in die Tabelle eingetragen wird.
4. Und dann auch ChronoChonnectivity erweitern falls CC verwendet wird um Tabellen anzuzeigen.
Hier dann nicht den Admin teil vergessen. Der ist für das anzeigen im Backend "show data" notwendig.

Beispiel:

Wir erweitern das Formular um ein cf_radiobutton Element um nach Art der Anrede zu Kategorisieren.

1. Komponenten -> ChronoForms -> Form Management, Formular wählen, dann Reiter Form Code -> Form Html und dort folgenden Code hinzufügen:

Hier soll ein code Snipped her.

Die Tagattribute value und name sind wichtig. Value ist der Wert der in die Tabelle eingetragen wird und name ist die Spalte/Feld in der der Wert eingetragen wird.

2. Über phpMyAdmin Tabelle um ein Feld erweitern
Feldname = Anrede, varchar der länge 4
Und schon ist das neue Feld fertig.
3. ChronoConnectivity im BackEnd sichtbar machen.
Komponenten -> Chrono Connectivity -> Connection Management
die Liste auswählen und beim Reiter AdminConfig folgendes eingeben.
Den Namen des Feldes der anzuzeigen ist und der Titel für das Feld. In meisten Fällen sind beide gleich.

Email Container/Bestätigungs-Mail einrichten

1. Klicke auf das Formular, das ein Email-Template erhalten soll, wähle Reiter "Setup Emails".
2. Oben links einen neuen "Mail Conntainer" erstellen.
3. Mail Conntainer füllen bis Hintergrund grün ist. Zum Beispiel wir fügen ein:
* Subject -> Email Betreff
* From Email -> Absender
* Dynamic To -> DB Feld eingeben wo die Emails eingetragen werden z.B. text_3 ohne geschweiften Klammern
* From Name
4. Links bei "Email Properties" enable yes auswählen und auf APPLY klicken und dann oben speichern.
5. Form nochmal auswählen und im "general" Reiter "Email the results" aktivieren.
Also, WICHTIG: Einmal beim konkreten Email Conntainer->Email Properties aktivieren und einmal beim general Reiter.
6. Testen ob email verschickt werden. Wieder über ChronoForm-FormsManager den Link auswählen, Form ausfüllen und schauen ob man eine Email bekommen hat.

Email Bearbeiten/Email Template erstellen

1. Wähle im ChronoForm-FormManger das Formular aus.
2. Klicke Reiter "Email Templates" und bearbeite ihn je nach Bedürfnissen.
3. mit geschweiften Klammern und dem Feldname der Tabelle können DB-Einträge mit eingefügt werden.

Tabellen mit Chrono Chonnectivity anzeigen lassen

1. neu chronoconectivity erstellen
2. header, body etc einfügen
3. Admin config, die wichtigsten einträge eingeben
4. Speicher und publizieren

Doppelte Einträge in DB vermeiden/umgehen

1. Über phpMyAdmin erstellte chronoforms Tabelle wählen
2. Felder die nur einmalig seien sollen als UNIQUE setzen

MySQL said: Documentation
#1071 - Specified key was too long; max key length is 1000 bytes

Lösung: Achte darauf das der gesamte UNIQUE Key nicht über 1000Bytes ist
GreyHead 19 Mar, 2009
Here's a slightly edited Google translation of Juan Pablo's notes

Formbuilder / forms generate

Requirements:
* Users should register for a course in a list / register can
* This list is intended only to "special" user be made visible
* Manager / trainer should be able to make new entries in the back end. Plus delete or edit existing entries.

Search:
* Chrono Forms
* Artform
* Factory
* FacilForms not availalbe for Joomla 1.5 -> successor BreezingForms (commercial product) $ $ $
* RSForm (commercial product) $ $ $

Chrono Forms:

Source: chrono forms
1. Component chrono forms stable version V3.0
2. Installing Chronopost Contact Module (not yet know what it really can do)
3. Installation of Chronopost Connectivity 1.2: create forms, database results returned
Tutorial Chronopost Connectivity

To create a registration form:

We are in the backend:

1. Menu-> Components-> Chrono Forms> Form Wizard
2. Design your form:
* Heading
* Name Textbox
* Last Name text box
* Email Textbox
* Heading
* Checkbox for AG
* Image Recognition against Attacks
* Application Button
Top left on the icon to click and save a unique name.
3. Chrono Forms Forms Manager: make sure that the ersteltte form is published.
4. ImageVerification was built, then also activate under AntiSpam.

DB table to create and connect

1. Choose the shape from the top left and click on "Create Table".
2. All fields that still have no check mark, and then click "Save Table" button.
3. After the message table "Table created successfully" connection to the table to produce. Choose the form.
4. Choose DB Connections tab. Set "Data Storage Enable" to yes, choose the newly created table and save it.
5. Quick Test. Click on the link, form fill button "Login" button, back to back and link ConnectedGroup Table column in the table view.

Table and form with other fields expand

1. Form with desired field expand. For example Text field, checkbox, etc.
2. About phpMyAdmin table expand, i.e. add new field
3. Components -> Chrono Forms -> Form Management, then select the form and shape to the rider code go. On Submit code - before sending email with the necessary changes, as defined here is what the table is registered.
4. And then also expand if ChronoChonnectivity CC is used to display tables.
You will not forget the admin part. The show is scheduled for the backend in the "show data" is necessary.

Example:

We expand the form to cf_radiobutton element according to the type of salutation to categorize.

1. Components -> Chrono Forms -> Form Management, select Form, then Form Code tab -> html form and then add the following code:

Here, a code snipped her.

The Tagattribute name and value are important. Value is the value of the table and name the column / field in which the value is entered.

2. About phpMyAdmin table to expand a field
Field name = title, varchar of length 4
And already the new field is ready.
3. ChronoConnectivity in BackEnd visible.
Components -> Chrono Connectivity -> Connection Management
the list and when riders enter AdminConfig.
The name of the field of view is and the title for the field. In most cases, are both the same.

Email Container / confirmation e-mail set up

1. Click on the form, an email template to receive, choose tab "setup emails".
2. Top left: a new "Mail Conntainer create.
3. Mail Conntainer fill up the background is green. For example, we add a:
* Subject -> Email Subject
* From Email -> Sender
* Dynamic To -> DB field where the emails are entered as text_3 without curly braces
* From Name
4. Links to "Email Properties" enable select yes and click on APPLY and then save up.
5. Form again and select the "General" tab "Email the results" box.
Also, IMPORTANT: Once the email specific Conntainer-> Properties Email activate and once for the general tab.
6. Testing if email sent. Re-form on Chronopost Manager form, select the link, fill out the form and see if you got an email.

Email Edit / Email template

1. Choose in-form shape Chronopost Manger the form.
2. Click tab "email templates" and edit it according to needs.
3. with curly brackets and the field name of the database table can be inserted with entries.

Tables with Chrono Chonnectivity display

1. Create new chronoconectivity
2. header, body etc insert
3. Admin config, enter the main entries
4. Store and publish

Duplicate entries in DB avoid / bypass

1. About phpMyAdmin chrono forms created table select
2. Only once the fields were set to be a UNIQUE

MySQL said: Documentation
# 1071 - Specified key was too long, max key length is 1000 bytes

Solution: Make sure all the UNIQUE key is not 1000Bytes


Bob
juanpablo 26 Mar, 2009
Hi there!

well I'm still having the problem with my form-registration which I mentioned already above somewhere:

I have one database table where people who want to register to the selected workshops/groups are stored.
To avoid duplicate entries y set through phpMyAdmin the "email" field as a unique key. Like this a person cannot register over and over with the same email.

Now, the following error appears when a registered person wants maybe to change some stored information he gets the error:

Tablechronoforms_anmelde_formular::store failed - Duplicate entry 'joomla.rosas@googlemail.com' for key 2 SQL=INSERT INTO `jos_chronoforms_anmelde_formular` ( `uid`,`recordtime`,`ipaddress`,`cf_user_id`,`Anrede`,`text_1`,`text_2`,`institution`,`text_3`,`strasse`,`plz`,`telefon`,`anzahl`,`alter`,`zerti` ) VALUES ( 'IMzQ4M2FkNDg4YjNh','2009-03-26 - 13:08:09','78.53.100.99','0','Herr','Frédéric','Rosas','Institut für Informatik Universität Leipzig, Deutschland','joomla.rosas@googlemail.com','Paul-Gruner-Strasse. 25','04107','01702384u7','','','Nein' )


The new selected workshops/groups are overwritten. Which is perfect. Only I would like to switch of the error message.
Or a way to hide this error message. I cannot imagine that there is no way.

Debug mode is already turned off.
save mode is turned off

doesn't any one know how to fix this little problem.

Best regards,
JP
Max_admin 26 Mar, 2009
Hi JP,

The new selected workshops/groups are overwritten



if you have another record then its better to do an update query here!!

tell me please how do you get this form to save data now ? do you have your own code for saving ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 26 Mar, 2009
...well actually it's also a mystery to me how data is saved. I think it's done internally by chronoforms.

what i have done so far:
1. created the form
2. than through forms manager I created a table and add the desired fields
3. under "db connection" I enable data storage on yes and chose the created table
and that's it.

I would like to use the update function but I think I have to use it before chronoforms tries to store the information (after hitting the submit button first check if entry already in if yes make update instead of insert.
And I don't know where to do this.

JP
Max_admin 26 Mar, 2009
hi Juan,

That's fine then, your table has some field defined as a "primary key", every record has a value for this one, all you need is to add a hidden input field to your form which will hold the value of the record to be updated, once you submit the form, the record will be updated and this error will not exist!

Regards
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 26 Mar, 2009
hey max,

thx for your advice but I'm afraid I can't follow you.
what is a hidden input field, how does it look like and where to put it?

Here is my form code:


<!-- Teilnehmerangaben -->

<div  class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Teilnehmerangaben</h1></div><div class="clear"> </div></div>

<DIV class=form_item>
 <DIV class="form_element cf_radiobutton">
  <DIV class=float_left>
   <INPUT class="radio validate-one-required" title="Pflichtfeld: Auswahl erforderlich." id=radio_1 type=radio value="Frau" name=Anrede>
   <LABEL class=radio_label for=radio_1>Frau</LABEL>
   <INPUT class=radio id=radio_2 type=radio value="Herr" name=Anrede>
   <LABEL class=radio_label for=radio_2>Herr</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Vorname</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="text_1" name="text_1" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Name</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="text_2" name="text_2" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Institution</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="institution" name="institution" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">Straße Nr.</label>
  <input maxlength="150" size="30" id="strasse" name="strasse" type="text">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">PLZ</label>
  <input maxlength="150" size="30" id="plz" name="plz" type="text">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">Telefon/Fax</label>
  <input maxlength="150" size="30" id="telefon" name="telefon" type="text"
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Email</b></label>
  <input class="cf_inputbox required validate-email" maxlength="150" size="30" id="text_3" name="text_3" type="text" title="Pflichtfeld: Bitte eine valide Email angeben.">
 </div>
 <div class="clear"> </div>
</div>


<!-- Arbeitsgruppen -->

<div  class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Arbeitsgruppen</h1></div><div class="clear"> </div></div>

<DIV class=form_item>
 <DIV class="form_element cf_text">
  <SPAN class=cf_text>An welchen Arbeitsgruppen werden Sie bevorzugt teilnehmen?<br> Für einen Überblick geben Sie uns bitte Ihre Wunsch-AG, aber auch Ihre zweite und dritte Wahl an.</SPAN>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">09.00-11.00 Uhr</label>
  <div class="float_left">
   <label for="AG1" class="check_label">AG 1</label>
   <input value="X" class="radio" id="AG1" name="AG1" type="checkbox"><br>   
   <label for="AG2" class="check_label">AG 2</label>
   <input value="X" class="radio" id="AG2" name="AG2" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">13.00-15.00 Uhr</label>
  <div class="float_left">
   <label for="AG3" class="check_label">AG 3</label> 
   <input value="X" class="radio" id="AG3" name="AG3" type="checkbox"><br>
   <label for="AG4" class="check_label">AG 4</label>
   <input value="X" class="radio" id="AG4" name="AG4" type="checkbox"><br>
   <label for="AG5" class="check_label">AG 5</label>
   <input value="X" class="radio" id="AG5" name="AG5" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">16.00-18.00 Uhr</label>
  <div class="float_left">
   <label for="AG6" class="check_label">AG 6</label> 
   <input value="X" class="radio" id="AG6" name="AG6" type="checkbox"><br>
   <label for="AG7" class="check_label">AG 7</label>
   <input value="X" class="radio" id="AG7" name="AG7" type="checkbox"><br>
   <label for="AG8" class="check_label">AG 8</label>
   <input value="X" class="radio" id="AG8" name="AG8" type="checkbox"><br>
   <label for="AG9" class="check_label">AG 9</label>
   <input value="X" class="radio" id="AG9" name="AG9" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>


<!-- Kinderbetreuung -->

<DIV class=form_item>
 <DIV class="form_element cf_heading">
  <H1 class=cf_text id="">Kinderbetreuung</H1>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_checkbox">
  <LABEL class=cf_label>Ich werde Kind/er zum Symposium mitbringen.</LABEL> 
  <DIV class=float_left>
   <INPUT class=radio id=JA type=checkbox value=JA name=kinder>
   <LABEL class=check_label for=JA>JA</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_textbox">
  <LABEL class=cf_label>Anzahl</LABEL>
  <INPUT class="cf_inputbox validate-number" id=text_6 maxLength=150 size=30 name=anzahl>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_textbox">
  <LABEL class=cf_label>Alter</LABEL>
  <INPUT class="cf_inputbox validate-alphanum" id=text_8 maxLength=150 size=30 name=alter>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_checkbox">
  <LABEL class=cf_label>Betreuungsbedarf melde ich für den</LABEL> 
  <DIV class=float_left>
   <INPUT class=radio id="18.06" type=checkbox value="x" name="do">
   <LABEL class=check_label for="18.06">18.06.2009, 13.00-19.00 Uhr</LABEL><BR>
   
   <INPUT class=radio id="19.06" type=checkbox value="x" name="fr">
   <LABEL class=check_label for="19.06">19.06.2009, 09.00-1800 Uhr</LABEL><BR>

   <INPUT class=radio id="20.06" type=checkbox value="x" name="sa">
   <LABEL class=check_label for="20.06">20.06.2009, 09.00-13.00 Uhr an.</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<!-- Zertifizierung -->

<div class="form_item">
 <div class="form_element cf_heading">
  <h1 id="" class="cf_text">Zertifizierung</h1>
 </div>
 <div class="clear"> </div>
</div>

<div class="form_item">
 <div class="form_element cf_text">
  <span class="cf_text">Geplant ist die Zertifizierung der Veranstaltung durch die Sächsische Bildungsagentur. Möchten Sie im Rahmen einer Fortbildung am Symposium teilnehmen?</span>
 </div>
 <div class="clear"> </div>
</div>

<DIV class=form_item>
 <DIV class="form_element cf_radiobutton">
  <DIV class=float_left>
   <INPUT class="radio validate-one-required" title="Pflichtfeld: Auswahl erforderlich." id=radio_ja type=radio value="Ja" name=zerti>
   <LABEL class=radio_label for=radio_ja>Ja</LABEL>
   <INPUT class=radio id=radio_nein type=radio value="Nein" name=zerti>
   <LABEL class=radio_label for=radio_nein>Nein</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>


<!-- Sicherheit AntiSpam -->

<div  class="form_item"><div class="form_element cf_captcha"><label class="cf_label">Imageverifikation</label><span>{imageverification}</span></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_button"><input value="Anmelden" name="undefined" type="submit"></div><div class="clear"> </div></div><!-- Teilnehmerangaben -->

<div  class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Teilnehmerangaben</h1></div><div class="clear"> </div></div>

<DIV class=form_item>
 <DIV class="form_element cf_radiobutton">
  <DIV class=float_left>
   <INPUT class="radio validate-one-required" title="Pflichtfeld: Auswahl erforderlich." id=radio_1 type=radio value="Frau" name=Anrede>
   <LABEL class=radio_label for=radio_1>Frau</LABEL>
   <INPUT class=radio id=radio_2 type=radio value="Herr" name=Anrede>
   <LABEL class=radio_label for=radio_2>Herr</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Vorname</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="text_1" name="text_1" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Name</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="text_2" name="text_2" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Institution</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="institution" name="institution" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">Straße Nr.</label>
  <input maxlength="150" size="30" id="strasse" name="strasse" type="text">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">PLZ</label>
  <input maxlength="150" size="30" id="plz" name="plz" type="text">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">Telefon/Fax</label>
  <input maxlength="150" size="30" id="telefon" name="telefon" type="text"
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Email</b></label>
  <input class="cf_inputbox required validate-email" maxlength="150" size="30" id="text_3" name="text_3" type="text" title="Pflichtfeld: Bitte eine valide Email angeben.">
 </div>
 <div class="clear"> </div>
</div>


<!-- Arbeitsgruppen -->

<div  class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Arbeitsgruppen</h1></div><div class="clear"> </div></div>

<DIV class=form_item>
 <DIV class="form_element cf_text">
  <SPAN class=cf_text>An welchen Arbeitsgruppen werden Sie bevorzugt teilnehmen?<br> Für einen Überblick geben Sie uns bitte Ihre Wunsch-AG, aber auch Ihre zweite und dritte Wahl an.</SPAN>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">09.00-11.00 Uhr</label>
  <div class="float_left">
   <label for="AG1" class="check_label">AG 1</label>
   <input value="X" class="radio" id="AG1" name="AG1" type="checkbox"><br>   
   <label for="AG2" class="check_label">AG 2</label>
   <input value="X" class="radio" id="AG2" name="AG2" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">13.00-15.00 Uhr</label>
  <div class="float_left">
   <label for="AG3" class="check_label">AG 3</label> 
   <input value="X" class="radio" id="AG3" name="AG3" type="checkbox"><br>
   <label for="AG4" class="check_label">AG 4</label>
   <input value="X" class="radio" id="AG4" name="AG4" type="checkbox"><br>
   <label for="AG5" class="check_label">AG 5</label>
   <input value="X" class="radio" id="AG5" name="AG5" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">16.00-18.00 Uhr</label>
  <div class="float_left">
   <label for="AG6" class="check_label">AG 6</label> 
   <input value="X" class="radio" id="AG6" name="AG6" type="checkbox"><br>
   <label for="AG7" class="check_label">AG 7</label>
   <input value="X" class="radio" id="AG7" name="AG7" type="checkbox"><br>
   <label for="AG8" class="check_label">AG 8</label>
   <input value="X" class="radio" id="AG8" name="AG8" type="checkbox"><br>
   <label for="AG9" class="check_label">AG 9</label>
   <input value="X" class="radio" id="AG9" name="AG9" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>


<!-- Kinderbetreuung -->

<DIV class=form_item>
 <DIV class="form_element cf_heading">
  <H1 class=cf_text id="">Kinderbetreuung</H1>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_checkbox">
  <LABEL class=cf_label>Ich werde Kind/er zum Symposium mitbringen.</LABEL> 
  <DIV class=float_left>
   <INPUT class=radio id=JA type=checkbox value=JA name=kinder>
   <LABEL class=check_label for=JA>JA</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_textbox">
  <LABEL class=cf_label>Anzahl</LABEL>
  <INPUT class="cf_inputbox validate-number" id=text_6 maxLength=150 size=30 name=anzahl>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_textbox">
  <LABEL class=cf_label>Alter</LABEL>
  <INPUT class="cf_inputbox validate-alphanum" id=text_8 maxLength=150 size=30 name=alter>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_checkbox">
  <LABEL class=cf_label>Betreuungsbedarf melde ich für den</LABEL> 
  <DIV class=float_left>
   <INPUT class=radio id="18.06" type=checkbox value="x" name="do">
   <LABEL class=check_label for="18.06">18.06.2009, 13.00-19.00 Uhr</LABEL><BR>
   
   <INPUT class=radio id="19.06" type=checkbox value="x" name="fr">
   <LABEL class=check_label for="19.06">19.06.2009, 09.00-1800 Uhr</LABEL><BR>

   <INPUT class=radio id="20.06" type=checkbox value="x" name="sa">
   <LABEL class=check_label for="20.06">20.06.2009, 09.00-13.00 Uhr an.</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<!-- Zertifizierung -->

<div class="form_item">
 <div class="form_element cf_heading">
  <h1 id="" class="cf_text">Zertifizierung</h1>
 </div>
 <div class="clear"> </div>
</div>

<div class="form_item">
 <div class="form_element cf_text">
  <span class="cf_text">Geplant ist die Zertifizierung der Veranstaltung durch die Sächsische Bildungsagentur. Möchten Sie im Rahmen einer Fortbildung am Symposium teilnehmen?</span>
 </div>
 <div class="clear"> </div>
</div>

<DIV class=form_item>
 <DIV class="form_element cf_radiobutton">
  <DIV class=float_left>
   <INPUT class="radio validate-one-required" title="Pflichtfeld: Auswahl erforderlich." id=radio_ja type=radio value="Ja" name=zerti>
   <LABEL class=radio_label for=radio_ja>Ja</LABEL>
   <INPUT class=radio id=radio_nein type=radio value="Nein" name=zerti>
   <LABEL class=radio_label for=radio_nein>Nein</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>


<!-- Sicherheit AntiSpam -->

<div  class="form_item"><div class="form_element cf_captcha"><label class="cf_label">Imageverifikation</label><span>{imageverification}</span></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_button"><input value="Anmelden" name="undefined" type="submit"></div><div class="clear"> </div></div><!-- Teilnehmerangaben -->

<div  class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Teilnehmerangaben</h1></div><div class="clear"> </div></div>

<DIV class=form_item>
 <DIV class="form_element cf_radiobutton">
  <DIV class=float_left>
   <INPUT class="radio validate-one-required" title="Pflichtfeld: Auswahl erforderlich." id=radio_1 type=radio value="Frau" name=Anrede>
   <LABEL class=radio_label for=radio_1>Frau</LABEL>
   <INPUT class=radio id=radio_2 type=radio value="Herr" name=Anrede>
   <LABEL class=radio_label for=radio_2>Herr</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Vorname</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="text_1" name="text_1" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Name</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="text_2" name="text_2" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Institution</b></label>
  <input class="cf_inputbox required" maxlength="150" size="30" id="institution" name="institution" type="text" title="Pflichtfeld: Eintrag erforderlich.">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">Straße Nr.</label>
  <input maxlength="150" size="30" id="strasse" name="strasse" type="text">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">PLZ</label>
  <input maxlength="150" size="30" id="plz" name="plz" type="text">
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label">Telefon/Fax</label>
  <input maxlength="150" size="30" id="telefon" name="telefon" type="text"
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_textbox">
  <label class="cf_label"><b>Email</b></label>
  <input class="cf_inputbox required validate-email" maxlength="150" size="30" id="text_3" name="text_3" type="text" title="Pflichtfeld: Bitte eine valide Email angeben.">
 </div>
 <div class="clear"> </div>
</div>


<!-- Arbeitsgruppen -->

<div  class="form_item"><div class="form_element cf_heading"><h1 id="" class="cf_text">Arbeitsgruppen</h1></div><div class="clear"> </div></div>

<DIV class=form_item>
 <DIV class="form_element cf_text">
  <SPAN class=cf_text>An welchen Arbeitsgruppen werden Sie bevorzugt teilnehmen?<br> Für einen Überblick geben Sie uns bitte Ihre Wunsch-AG, aber auch Ihre zweite und dritte Wahl an.</SPAN>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">09.00-11.00 Uhr</label>
  <div class="float_left">
   <label for="AG1" class="check_label">AG 1</label>
   <input value="X" class="radio" id="AG1" name="AG1" type="checkbox"><br>   
   <label for="AG2" class="check_label">AG 2</label>
   <input value="X" class="radio" id="AG2" name="AG2" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">13.00-15.00 Uhr</label>
  <div class="float_left">
   <label for="AG3" class="check_label">AG 3</label> 
   <input value="X" class="radio" id="AG3" name="AG3" type="checkbox"><br>
   <label for="AG4" class="check_label">AG 4</label>
   <input value="X" class="radio" id="AG4" name="AG4" type="checkbox"><br>
   <label for="AG5" class="check_label">AG 5</label>
   <input value="X" class="radio" id="AG5" name="AG5" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>

<div  class="form_item">
 <div class="form_element cf_checkbox">
  <label class="cf_label">16.00-18.00 Uhr</label>
  <div class="float_left">
   <label for="AG6" class="check_label">AG 6</label> 
   <input value="X" class="radio" id="AG6" name="AG6" type="checkbox"><br>
   <label for="AG7" class="check_label">AG 7</label>
   <input value="X" class="radio" id="AG7" name="AG7" type="checkbox"><br>
   <label for="AG8" class="check_label">AG 8</label>
   <input value="X" class="radio" id="AG8" name="AG8" type="checkbox"><br>
   <label for="AG9" class="check_label">AG 9</label>
   <input value="X" class="radio" id="AG9" name="AG9" type="checkbox"><br>
  </div>
 </div>
 <div class="clear"> </div>
</div>


<!-- Kinderbetreuung -->

<DIV class=form_item>
 <DIV class="form_element cf_heading">
  <H1 class=cf_text id="">Kinderbetreuung</H1>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_checkbox">
  <LABEL class=cf_label>Ich werde Kind/er zum Symposium mitbringen.</LABEL> 
  <DIV class=float_left>
   <INPUT class=radio id=JA type=checkbox value=JA name=kinder>
   <LABEL class=check_label for=JA>JA</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_textbox">
  <LABEL class=cf_label>Anzahl</LABEL>
  <INPUT class="cf_inputbox validate-number" id=text_6 maxLength=150 size=30 name=anzahl>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_textbox">
  <LABEL class=cf_label>Alter</LABEL>
  <INPUT class="cf_inputbox validate-alphanum" id=text_8 maxLength=150 size=30 name=alter>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<DIV class=form_item>
 <DIV class="form_element cf_checkbox">
  <LABEL class=cf_label>Betreuungsbedarf melde ich für den</LABEL> 
  <DIV class=float_left>
   <INPUT class=radio id="18.06" type=checkbox value="x" name="do">
   <LABEL class=check_label for="18.06">18.06.2009, 13.00-19.00 Uhr</LABEL><BR>
   
   <INPUT class=radio id="19.06" type=checkbox value="x" name="fr">
   <LABEL class=check_label for="19.06">19.06.2009, 09.00-1800 Uhr</LABEL><BR>

   <INPUT class=radio id="20.06" type=checkbox value="x" name="sa">
   <LABEL class=check_label for="20.06">20.06.2009, 09.00-13.00 Uhr an.</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>

<!-- Zertifizierung -->

<div class="form_item">
 <div class="form_element cf_heading">
  <h1 id="" class="cf_text">Zertifizierung</h1>
 </div>
 <div class="clear"> </div>
</div>

<div class="form_item">
 <div class="form_element cf_text">
  <span class="cf_text">Geplant ist die Zertifizierung der Veranstaltung durch die Sächsische Bildungsagentur. Möchten Sie im Rahmen einer Fortbildung am Symposium teilnehmen?</span>
 </div>
 <div class="clear"> </div>
</div>

<DIV class=form_item>
 <DIV class="form_element cf_radiobutton">
  <DIV class=float_left>
   <INPUT class="radio validate-one-required" title="Pflichtfeld: Auswahl erforderlich." id=radio_ja type=radio value="Ja" name=zerti>
   <LABEL class=radio_label for=radio_ja>Ja</LABEL>
   <INPUT class=radio id=radio_nein type=radio value="Nein" name=zerti>
   <LABEL class=radio_label for=radio_nein>Nein</LABEL><BR>
  </DIV>
 </DIV>
 <DIV class=clear> </DIV>
</DIV>


<!-- Sicherheit AntiSpam -->

<div  class="form_item"><div class="form_element cf_captcha"><label class="cf_label">Imageverifikation</label><span>{imageverification}</span></div><div class="clear"> </div></div><div  class="form_item"><div class="form_element cf_button"><input value="Anmelden" name="undefined" type="submit"></div><div class="clear"> </div></div>


take in minde that I don't use cb_login or something similar. Intrested person is only able to register by filling out the form.

best regard,
jp
Max_admin 26 Mar, 2009
Hi Juan,

looking at the error you posted earlier, the table was created using Chronoforms, if you had teh cf_id as the primary key then its the primary key!

the code would then be:

<input type="hidden" name="cf_id" value="25" >


so, whoever the user with cf_id = 25 in the table, his/her details will get overwritten by the new posted data!

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 27 Mar, 2009
...sorry, can still not follow your thinking.😑

looking at the error you posted earlier, the table was created using Chronoforms, if you had teh cf_id as the primary key then its the primary key!



... yes, "cf_id" is the primary key.

the code would then be:

... <input type="hidden" name="cf_id" value="25" >


so, whoever the user with cf_id = 25 in the table, his/her details will get overwritten by the new posted data!
...



...if a person who is already registered and does it again. he doesn't know which cf_id he had the first time. how to get the e.g. value 25? should I make a check before the record is tried to be saved into table? where to do this check? And how to get the value.

I think I didn't understand your idea. I would be very thankful if you tray to clarify it for me.

Best regards,
JP
Max_admin 27 Mar, 2009
Hi Juan,

if you are doing it the way I think about, then for any registered user to update his/her details, he/she should be logged in, correct or not ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 30 Mar, 2009
...no, there is no posibility to log in. Only to register to a group, well actually only allowed to put information in a table everyone.

ps: sorry for late reply.

regards,
JP
Max_admin 30 Mar, 2009
well, then how do you want to check if the user already exists and update him/her ? may be using the email as its unique but in this case you have to query the table and build an update statement using a PHP code in the onsubmit box!🙂

Cheers
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
juanpablo 31 Mar, 2009
...or you switch of the mySql error somewhere.
here is the site with the form:

http://www.erzwiss.uni-leipzig.de/2009/index.php?option=com_chronocontact&chronoformname=anmelde_formular

to see the errormessage that I don't want to be displaied, login twice with the same email.

How I believe the update is being done. when you hit the submit button. it will first perform an insert statement and if there is a duplicate entry it will perform an update. It works perfekt only the bloody message ...

or like you said to put a check - written in php - before the insert statement is going to be executed. where to do that???
The "on submit code" section does things after the insert statement has been done.

Regards,
JParrow-right
Max_admin 31 Mar, 2009
Hi Juan,

The "on submit code" section does things after the insert statement has been done.



No, in this case, you will completely disable the Chronoforms DB connection and do both the PHP check and the insert/update code yourself!🙂

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.