Forums

Form works from backend, but not frontend?

fribse 07 Dec, 2011
I was thinking I was going crazy, I finally got my form up and running, and it was tested and tried, but when I published it, I immediately got complaints that it wasn't working.

I've created a simple form for entering values in a DB.
The form does a DB load to check if the value is already present, and if so, gives an error, if not, it saves the values, and reloads the form.

This works when clicking on the 'Frontend view' from forms manager backend.
But when I publish it as a menuitem, it will not process the DB load, and it will not save values to the DB.
If I remove the DB load check, and just creates a DB save instead, it does save the data.

This is J1.7.3 and C4RC2
fribse 08 Dec, 2011
I've just re-checked, and with maximum error reporting and firebug, I do not see any errors.
Max_admin 09 Dec, 2011
Hi,

Do you have the form in an article ? please make sure the cache is disabled when testing ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
GreyHead 09 Dec, 2011
Hi Fribse,

I haven't had time today to dig in the code but it appears that the On No/Empty Param passed event is being triggered when there is no record found and not the On Empty Result event.

Bob
GreyHead 09 Dec, 2011
Hi Frisbe,

There's a little bug in the action that gives that odd result :-(

Please open administrator/components/com_chronoforms/form_actions/db_record_Loader/db_record_loader.php Find this line around line 66
$request_val = JRequest::getVar($params->get('request_param', ''))
and replace it with this line
$request_val = $form->data[$params->get('request_param', '')];

Bob

PS There also appear to be a pair if matching bugs that cancel each other out but make the code a little confusing. In db_record_loader.php there is this code
}else if( empty($request_val) ) { 
  $this->events['nodata'] = 1;
}else if(empty($data)){
  $this->events['notfound'] = 1;
This sets 'notfound' if there is no data and vice versa.

In db_record_loader.ctp is this code
<div id="cfactionevent_db_record_loader_{n}_notfound" class="form_event bad_event">
  <label class="form_event_label">On Empty Result</label>
</div>
<div id="cfactionevent_db_record_loader_{n}_nodata" class="form_event bad_event">
  <label class="form_event_label">On No/Empty Param Passed</label>
</div>
Which attaches the 'wrong' labels to the events i.e. 'notfound' is labelled 'On Empty Result' and vice versa.
fribse 11 Dec, 2011
Ok, so if I put my 'error' in the 'empty params passed' place, it returns an error on the correct place, and with the patch above, it saves some data if it's not found.

The data is screwed up though:
year 	11
week 	10
day 	>Onsdag</option> <option value= 
ugedagtekst 	10 >Onsdag tion value=
check 	1110 >Onsdag tion value=
gsk 	0
dkdb 	1
aqua 	0
greve 	0
input_submit_8 	Gem


day should be Ons
ugedagtekst should be 10 Ons
check should be 1110 ons

I think I'll skip the above patch for now, and just keep it simple and working, and with no error checking, and wait until there's some proper patches in place.

Thankyou very much for looking into this, and also locating a bug, I hope it'll be fixed soon...
fribse 11 Dec, 2011
This is getting more and more strange.
The development form is called halstats-copy, and if I place that in the front end, I get the correct values saved.
If I click on the form, and change the 'Form Name' to halstats2, then I get the above, very strange, result.
It seems though, that if I go and use the wizard edit, and change the form name from there, it doesn't mess up the form, and the data is saved correctly.
I'm going to test further, to make sure that it's consistent.
GreyHead 11 Dec, 2011
Hi fribse,

Changing the form name shouldn't cause a problem, I do it quite often. There is a possible problem with dashes in names and DB Saves but I don't think that is what is happening here.

The odd data you posted looks as though there are some missing quotes somewhere - though I can't tell where.

You shouldn't need to use the code fix if you are OK with using the 'wrong' actions to run your checks.

Bob
fribse 13 Dec, 2011
Hi Greyhead

I hope there will be an update in the future, so to lessen the need for remembering more or less odd workaround, I'm going to implement the fix, so that I can use the correct actions, and when the update arrive sometime in the future, fixing all these odd little things, it's not going to break my form.

Thankyou very much for your help!
GreyHead 15 Dec, 2011
Hi Fribse,

Sounds like a good approach!!

Max is working on the next version and hopefully that will sweep up a lot of these little niggly bugs.

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