Forums

Mandatory Fields and error messages

Tom3000 17 Sep, 2014
Hello,

for my Joomla 2.5. based website i have installed Chronoforms v5 to include forms into my K2 component – this works already fine as the forms are displayed within K2 as requested.

Anyhow I face some issues:

1.Checkbox for “terms of use” and drop down list for country
In order to accept “terms of use”, checkbox needs to be ticked and correct entry of dropdown for country needs to be choosen (Austria is displayed as standard) – once done the data of the form can be submitted without any error. For some reason, the mail which is sent after submitting the form, shows all fields of the form, but the data for “terms of use” and country are blank?

2.Put hyperlink to checkbox text
Is it possible to put a hyperlink to the text “accept terms of use” for the terms of use checkbox?

3.Include database
With a short tutorial I linked a database to the form, put a “DB Save” in the Setup menu of the form in the area “on submit” – in “DB Save” I have choosen the corret database. After submitting the form and checking the entries of the database I have exported the data into CSV. In this file I only see some fields like ID, unique_id, creation date instead of the other 10 fields which have been submitted in the form. Moreover, the data of unique_id is encrypted. What needs to be adjusted so I can see the real submitted data of the form in the database?

4.Error message
All fields of the form are defined mandatory, so if one field is left out the error message “This field is required” appears. Can the text of this error message be adjusted somewhere?

Hope somebody can help me!

Thanks,
Tom
GreyHead 17 Sep, 2014
Hi Tom,

It sounds as though there are some mismatches in your input names. Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.

You can set individual element error messages in the Title box of each element.

Bob
Tom3000 18 Sep, 2014
Hi Bob,

thanks for your quick reply! Please find below the results of the debugger:

Data Array:
Array
(
    [option] => com_chronoforms5
    [chronoform] => gewinnspiel_k2
    [event] => submit
    [Itemid] => 
    [text13] => Thomas
    [text10] => Schweitzer
    [text17] => Liese Prokop Siedlung 2/3
    [text18] => 3361
    [text19] => Aschbach-Markt
    [Land] => 0
    [text25] => schweitzer.th@gmx.at
    [checkbox30] => 1
    [button11] => Teilnehmen
    [ip_address] => 80.122.153.6
    [id] => 3
)


Array
(
)


Errors:
Array
(
)


Debug Info:
Array
(
    [5] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:admin@dienanny.at
                    [2] => Subject:Gewinnspiel K2
                    [3] => From name:Chronoforms
                    [4] => From email:admin@dienanny.at
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Body:
<table>
<tr><td>Vorname</td><td>Thomas</td></tr>
<tr><td>Nachname</td><td>Schweitzer</td></tr>
<tr><td>Anschrift</td><td>Liese Prokop Siedlung 2/3</td></tr>
<tr><td>PLZ</td><td>3361</td></tr>
<tr><td>Ort/Stadt</td><td>Aschbach-Markt</td></tr>
<tr><td>Land</td><td></td></tr>
<tr><td>EMail</td><td>schweitzer.th@gmx.at</td></tr>
<tr><td>AGBs</td><td></td></tr>
</table><br /><br />IP: 80.122.153.6
                )

        )

    [6] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => INSERT INTO `jos_chronoengine_chronoforms_datatable_gewinnspiel_k2` (`user_id`, `uniq_id`, `created`) values ('0', 'd1f640f838f1675c37ebd6fc60a46d8e45c07040', '2014-09-18 05:56:27');
                        )

                )

        )

)


Thanks,
Tom
GreyHead 18 Sep, 2014
Hi Tom,

It looks as though the columns for the other inputs don't exist in the table?? If they do, then please click the Delete Cache icon in the Forms Manager toolbar to update the ChronoForms table record.

It also looks as though you need to update the Email template.

Bob
Tom3000 18 Sep, 2014
Hi Bob,

the clomuns for the input exist in the table - i also deleted the cache, but still no improvement.

What do you mean with updating email template - how to do this?

Thanks,
Thomas
GreyHead 18 Sep, 2014
Hi Tom,

By all means email or PM me the site URL, the form name, and a SuperAdmin login and I'll take a quick look.

Looking again, I was wrong about the email - I didn't look closely enough and thought that some fields were missing.

Bob
Tom3000 18 Sep, 2014
Hi Bob, thanks! Sent you already PM
GreyHead 18 Sep, 2014
Hi Tom,

The columns didn't exist in the table. I've installed the AceSQL extension so that I could see the tables from the Site Admin.

I've created a new table and attached the DB Save to that and all seems to be OK.

Bob
Tom3000 19 Sep, 2014
Hi Bob,

thank you very much for your help - everything works fine now!

Except on small issue - is there a chance to link the description text of a check box with another site? e.g. text "accept terms of use" to be linked with the correct website to be opened once clicked?

Thanks,
Thomas
GreyHead 19 Sep, 2014
Hi Tom,

I think that you can add a link into one of the Label or sub-label boxes to do that.

Bob
Tom3000 21 Sep, 2014
Hi Bob,

now also adding a hyperlink to a checkbox description worked out fine!🙂

As the form is now complete i embedded it into a K2 item (http://www.dienanny.at/blog/item/201-verlosung-pinguin-sandspiel-set), but have again issues with saving of the data in the database, as no entry in the form is saved. But testing the form in the admin area everything was saved correctly in the database?!

Data Array:
Array
(
    [chronoform] => gewinnspiel
    [event] => submit
    [Itemid] => 117
    [option] => com_k2
    [view] => item
    [task] => 201:verlosung-pinguin-sandspiel-set
    [id] => 201:verlosung-pinguin-sandspiel-set
    [vorname] => First
    [nachname] => Last
    [anschrift] => Street
    [plz] => 3154
    [ort] => Town
    [land] => AT
    [email] => 
 mail@mail.com
    [agb] => 1
    [teilnehmen] => Teilnehmen
    [gewinnspiel] => 
    [ip_address] => 194.118.179.173
)

Array
(
)


Errors:
Array
(
)


Debug Info:
Array
(
    [1] => Array
        (
            [Email] => Array
                (
                    [0] => An email with the details below was sent successfully:
                    [1] => To:
 admin@dienanny.at
                    [2] => Subject:Gewinnspiel Sandkistenspieleset
                    [3] => From name:Chronoforms
                    [4] => From email:
 admin@dienanny.at
                    [5] => CC:
                    [6] => BCC:
                    [7] => Reply name:
                    [8] => Reply email:
                    [9] => Attachments:
                    [10] => Body:
<table>
<tr><td>Vorname</td><td>First</td></tr>
<tr><td>Nachname</td><td>Last</td></tr>
<tr><td>Anschrift</td><td>Street</td></tr>
<tr><td>PLZ</td><td>3154</td></tr>
<tr><td>Ort/Stadt</td><td>Town</td></tr>
<tr><td>Land</td><td>AT</td></tr>
<tr><td>Email</td><td>
 mail@mail.com</td></tr>
<tr><td>AGB</td><td>1</td></tr>
</table><br /><br />IP: 194.118.179.173
                )

        )

    [2] => Array
        (
            [DB Save] => Array
                (
                    [Queries] => Array
                        (
                            [0] => UPDATE `jos_chronoengine_chronoforms_datatable_gewinnspiel_a` AS `Data` SET `vorname` = 'First', `nachname` = 'Last', `anschrift` = 'Street', `plz` = '3154', `ort` = 'Town', `land` = 'AT', `email` = '
 mail@mail.com', `agb` = '1', `teilnehmen` = 'Teilnehmen', `user_id` = '51', `modified` = '2014-09-21 19:36:11' WHERE `id` = '201:verlosung-pinguin-sandspiel-set';
                        )

                )

        )

)


I guess this has something to do with the code in the last lines of above screenshot "WHRE 'id' = '201:verlosung ...." what do you think? But what is the issus as in testing everything worked out fine?

Thanks,
Tom
GreyHead 22 Sep, 2014
Hi Tom,

I think that the problem is the id being set from the page URL [id] => 201:verlosung-pinguin-sandspiel-set The DB Code is trying to update this record which doesn't exist.
UPDATE `jos_chronoengine_chronoforms_datatable_gewinnspiel_a` 
. . . 
WHERE `id` = '201:verlosung-pinguin-sandspiel-set';

There are two ways round this: you can change the name of the column in the table to say 'cf_id' or you can add a Custom Code action to the form to unset the unwanted id value
<?php
unset($form->data['id']);
?>

Bob
Tom3000 22 Sep, 2014
Hi Bob,

thanks for your reply!

I now changed the name of the column in the table to say "cf_id" and now a new entry has been made in the database. checking the details of this entry in the database just the name of the various columns are shown but not the entered data of the form.

Checking the data of the table with ACESql, there is also one entry shown and here also the data entered in the form is visible now?!? Why is the entered data not visible accessing the db via chronoform?

Thanks,
Thomas
GreyHead 22 Sep, 2014
Hi Tom,

I think that the View Data in ChronoForms must be coded to expect 'id' as the primary key ??? I have seen the same thing - but I almost always use AceSQL to work with and view tables.

You might try clicking the Delete Cache icon in the Forms Manager toolbar as that updates CF's saved records about the database table structure.

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