CF4 uses the "DB Record Loader" action with settings as follows:
[attachment=0]CC-old.PNG[/attachment]
CF5 uses "DB Read"
[attachment=0]CC-old.PNG[/attachment]
The problem is I don't know what I need to put in the CF5 settings to achieve the same as those of CF4. I can't quiet work out what goes where ie. where do I put the references to uniqueid?
CFv4 had two ways of setting a 'WHERE' clause, the basic DB Field = Request Parameter or the WHERE box.
In CFV5 these are both in the Conditions box. Please see this FAQ for the syntax to use.
Bob
ie. I will need
<?php
return array('model_id.uniqueid' => 'value');
?>
But I am not sure how to get the 'value' part from the parameter; even after looking at the examples.
In ChronoForms:
$form->data['uniqueid']
but if that is a string it needs to be quoted!
Bob
http://www.mysite.com/index.php?option=com_chronoforms5&chronoform=emailstaff&uniqueid=aqwe231
then I can us the following in the DB read action for CF5
<?php
$value = $form->data['uniqueid']
return array('model_id.uniqueid' => $value);
?>
Yes that looks OK to me, subject to the need to quote the string. I'd try it and see if it works.
Bob
Here is on onload sequence
[attachment=0]On Load.PNG[/attachment]
The form always loads i.e. something is always found meaning that
<?php
$value = $form->data['uniqueid']
return array('model_id.uniqueid' => '$value');
?>
always returns a result which is not possible.
There's a ; missing from the end of the first line of code. Is that the problem?
Bob
Fixed that but it made no difference. The DB Read always returns the first entry in the table.
Then the problem may be the quotes round '$value' I don't think that will work the way you want it to. If the value is an integer you can leave them off. See the FAQ for a different method it it is a string.
Bob
So I changed the code to
<?php
$var = $form->data['uniqueid']
$var = JRequest::getVar('param','', 'get');
$dbo = \GCore\Models\MODEL_ID::getInstance()->dbo;
$var = $dbo->quote($var);
return array (":model_id.uniqueid > {$var}");
?>
But I get the same result. At the moment what is most confusing is that the first record is always returned which means the redirection never happens there is always a positive hit.
Please drag a Debugger action into the On Submit event, then submit the form and post the debug results here.
Bob
This won't help as they error happens before submitting i.e the onload part is meant to be redirecting so that page does not load without the uniqueid parameter. It however loads regardless.
But here is the debug info anyway
Array
(
[10] => Array
(
[Check Honeypot] => Array
(
[0] => Honeypot check passed.
)
)
[5] => Array
(
[Email] => Array
(
[0] => An email with the details below could NOT be sent:
[1] => To:
[2] => Subject:
[3] => From name:
[4] => From email:reception@school.nz
[5] => CC:
[6] => BCC:
[7] => Reply name:Andre
[8] => Reply email:noreply@school.nz
[9] => Attachments:
[10] => Body:
<table>
<tr><td><strong>CONTACT DETAILS</strong></td><td> </td></tr>
<tr><td>First Name</td><td>Andre</td></tr>
<tr><td>Surname</td><td>Basel</td></tr>
<tr><td>Email</td><td>noreply@school.nz</td></tr>
<tr><td>Phone</td><td>1234566</td></tr>
<tr><td><strong>MESSAGE</strong></td><td> </td></tr>
<tr><td>Subject</td><td></td></tr>
<tr><td>Message</td><td>Test</td></tr>
</table><br /><br />IP: 124.150.174.28
)
)
)