Forums

Preserving form fields values?

lightbeing 28 Sep, 2007
Hi,

I am using Chrono Forms 2.0 and when I fillin my form and say I made a mistake in entering the captcha (Imageverification) phrase, the form resets back to empty fields. As you can imagine this is not very friendly if you have a large form with many fields that you have entered. Is there any way to avoid this but need to keep the captcha / Imageverification functionality?

Many thanks for your help.

Al<br><br>Post edited by: lightbeing, at: 2007/09/28 13:03
lightbeing 28 Sep, 2007
I have just upgraded to the latest stable release v2.3.4 and it is still clearing my form fields when I enter a wrong value for the imageverification. Is this a bug or a feature? Any help will be very appreciated.

Regards,

Al
lightbeing 28 Sep, 2007
I have just upgraded to the latest stable release v2.3.4 and it is still clearing my form fields when I enter a wrong value for the imageverification. Is this a bug or a feature? Any help will be very appreciated.

Regards,

Al
Max_admin 28 Sep, 2007
Hi Al,

You should have version 2.3.4 or later installed then you should add this piece of code inside the value attribute of each field to keep its value :

<?php echo $_POST['field_name_goes_here']; ?>


this will keep the submitted value for this field!!๐Ÿ™‚

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
lightbeing 28 Sep, 2007
Thanks Max that worked for an input field๐Ÿ™‚. How about keeping the values of a dropdown or radio button field(s)?

Regards,

Al<br><br>Post edited by: lightbeing, at: 2007/09/28 16:05
Max_admin 28 Sep, 2007
Nice question, this will need alittle longer PHP to check the submitted value, and in case of a dropdown you echo "selected" at the right option and in case of radio you echo "checked"!!๐Ÿ™‚

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
PlayGod 29 Dec, 2007
For TEXTAREA, you must insert the php code between the TEXTAREA tags instead of in value=""

<TEXTAREA name="address" cols="24" rows="2" class="h20" value=""><?php echo $_POST['address']; ?></TEXTAREA>


this will need alittle longer PHP to check the submitted value



A little help here? Do you have an example of said PHP script to check submitted value?<br><br>Post edited by: PlayGod, at: 2007/12/29 01:43
PlayGod 30 Dec, 2007

this will need alittle longer PHP to check the submitted value



A little help here? Do you have an example of said PHP script to check submitted value?
GreyHead 30 Dec, 2007
Hi PlayGod,

I've updated the FAQ here to include this.

Bob
PlayGod 31 Dec, 2007
Thanks, that's very helpful... but I noticed a few problems with the FAQ...

<textarea. . .><?php echo $_POST['field_name']</textarea>

is missing the close ; ?>
<textarea. . .><?php echo $_POST['field_name']; ?></TEXTAREA>


and for radio or checkbox buttons... try the following to properly create an array of values and check them...

                      <input type="checkbox" name="property-type[0]" value="single family home" <?php if($_POST['property-type'][0] == 'single family home')echo' checked '; ?> />
                      Single Family Homes<br>
                      <input type="checkbox" name="property-type[1]" value="duplexes" <?php if($_POST['property-type'][1] == 'duplexes')echo' checked '; ?> />
                      Duplexes<br>
                      <input type="checkbox" name="property-type[2]" value="apartment community" <?php if($_POST['property-type'][2] == 'apartment community')echo' checked '; ?> />
                       Apt Community<br>
                      <input type="checkbox" name="property-type[3]" value="commercial" <?php if($_POST['property-type'][3] == 'commercial')echo' checked '; ?> />
                      Commercial Property<br>
                      <input type="checkbox" name="property-type[4]" value="home owners association" <?php if($_POST['property-type'][4] == 'home owners association')echo' checked '; ?> />
                      Home Owner Association</td>
<br><br>Post edited by: PlayGod, at: 2007/12/31 19:47
GreyHead 01 Jan, 2008
Hi PlayGod,

Sorry about the missing code . . . my excuse is that the FAQ editor isn't very good at handling code and I have to work out which <>s have to switched to entities. I'll try and fix it . . .

Bob
PlayGod 02 Jan, 2008
Tried publishing GeSHi and Code Support mambots in the Administrator?
GreyHead 02 Jan, 2008
Hi PlayGod,

Hmmm they are turned on but the mambots aren't active with the EasyFaq module . . . I think I fixed the FAQ here though.

Bob
sepppp 13 Apr, 2008
halloooooooo
this piece of code works in my form as well, but what about the typed text in a textarea. it seems not work there.
thanks in advance
sepppp


upppps, sorry for writing that. i didn't realize that there where other 2 pages to read. please delete my stupid post<br><br>Post edited by: sepppp, at: 2008/04/12 21:52
PlayGod 13 Apr, 2008
see attached .cfbak file for textarea code [file name=maintenance_inquiry.cfbak size=5227]http://www.chronoengine.com/components/com_fireboard/uploaded/files/maintenance_inquiry.cfbak[/file]
This topic is locked and no more replies can be posted.