Forums

Data lost after validation

BlueFrontierIT 11 Jan, 2010
Hi there, we're running validation on submit which all works fine for our required fields, however if a user submits the form in an incomplete state the validation is run on submit and the page is refreshed then all of the previous data the user has added is lost. Is there any way to retrieve the previously entered data?

Any help greatly appreciated.
GreyHead 11 Jan, 2010
Hi BlueFrontierIT,

On the Form General Tab set "Republish fields if error occured" to 'Try to republish'.

Bob
BlueFrontierIT 11 Jan, 2010
Works like a charm😀

Many thanks Bob
hang0ver 25 Jan, 2010
Hi!

I tried this as well but every time I activate "Republish fields if error occured" and fill out all the fields in the form except the captcha validation an arry like this:

Array ( [0] => text_1 [1] => text_2 [2] => text_3 [3] => text_4 [4] => text_5 [5] => text_6 [6] => text_7 [7] => check0 [13] => text_8 [14] => check1 [16] => text_9 [17] => text_10 [18] => button_17 ) /name=("|')(.*?)("|')/i /value=("|')(.*?)("|')/i /name=("|')(.*?)("|')/i /value=("|')(.*?)("|')/i /name=("|')(.*?)("|')/i /value=("|')(.*?)("|')/i /name=("|')(.*?)("|')/i /value=("|')(.*?)("|')/i /name=("|')(.*?)("|')/i /value=("|')(.*?)("|')/i /name=("|')(.*?)("|')/i /value=("|')(.*?)("|')/i /name=("|')(.*?)("|')/i /value=("|')(.*?)("|')/i /name=("|')(.*?)("|')/i /value=("|')(.*?)("|')/i

occurs in the html section right below the alert message div. Where does this come from?
How to solve/hide it?
GreyHead 25 Jan, 2010
Hi hang0ver,

No idea. The first part is an array of the input names in your form. From '/name . . . on looks completely unfamiliar to me.

Can you post a link to the form?

Bob
nml375 26 Jan, 2010
Not sure if this helps, but that last part looks like a regular expression to me.
In fact, the very same regexp is located on a number of lines in libraries/includes/JSrepublish.php
The same pattern is also present in the cf_profile.php plugin file.
I'm not sure if, or how, this would be leaked into the form however..


/Fredrik
GreyHead 26 Jan, 2010
Yes it does look as though it's mis-outputting from the JSrepublish.php file.

I wonder if the file is corrupt - the first array could be showing from the commented out print_r statement at line 7.

Bob
hang0ver 26 Jan, 2010
Hey guys - thank you!

So it would be the best way to replace the JSrepublish.php or to reinstall the chronoform completely?
I have no FTP access to this project...

Best regards
hang0ver
GreyHead 26 Jan, 2010
Hi hang0ver,

Do you have enough permissions to install exTplorer and get it running?

Bob
hang0ver 26 Jan, 2010
Hey GreyHead,

thank you for your support. I don't have the necessary permission rights yet but there are some issues to fix so I'll get them soon.
What are the next steps after installing exTplorer?

hang0ver
GreyHead 26 Jan, 2010
Hi hang0ver,

I'd take a look at the file and see if there is any sign of it being damaged - and, if so, copy and paste in the the contents from a good version.

Bob
hang0ver 02 Feb, 2010
Hi

today I got FTP access to the project and replaced the corrupt JSrepublish.php by a new file (V3.1_RC5.2) - now there's a new warning:


Warning: htmlentities() expects parameter 1 to be string, array given in /../components/com_chronocontact/libraries/includes/JSrepublish.php on line 19

Any hints? The former code snippet is not displayed any longer.

Thanks hang0ver
GreyHead 02 Feb, 2010
Hi hang0ver,

That's not the current version of the file - the current one has code to explode the array into a string
$allfieldsnames = array_unique($allfieldsnames);
//print_r($allfieldsnames );
foreach($allfieldsnames as $allfieldsname){
    if(!isset($post[$allfieldsname])){
        $post[$allfieldsname] = '';
    }else{
        if(is_array($post[$allfieldsname])){
            $post[$allfieldsname] = implode(', ', $post[$allfieldsname]);
        }
        $post[$allfieldsname] = htmlentities($post[$allfieldsname], ENT_QUOTES, 'UTF-8');
    }
}

Bob
hang0ver 02 Feb, 2010
Everything works perfectly now!
Thank you for the great support - I really appreciate that!

best regards
hang0ver
This topic is locked and no more replies can be posted.