I have read all the post on the forum and just can't figure this out.
I know I am missing something simple. I have a db multi-record wizard form that correctly calls a custom form called DeleteMember and passes cf_id as a request item.
The html code in my custom form is:
All that happens is the a DeleteMember display a blank form.
Any help is greatly appreciated.
I know I am missing something simple. I have a db multi-record wizard form that correctly calls a custom form called DeleteMember and passes cf_id as a request item.
The html code in my custom form is:
<?php
$cf_id = JRequest::getInt('cf_id', '', 'get');
echo $cf_id;
$db =& JFactory::getDBO();
$query = "
DELETE
FROM `cbc_chronoforms_data_churchmembers`
WHERE `cf_id` = '{$cf_id}' ;
";
$db->setQuery($query);
$db->query();
$mainframe =& JFactory::getApplication();
$mainframe->redirect('index.php?option=com_chronoforms&chronoforms/?chronoform=ChurchFamilyMemberList&fid={$fid}');
?>
All that happens is the a DeleteMember display a blank form.
Any help is greatly appreciated.
Hi jhainsworth,
That looks Ok apart from the redirect URL which has some junk left in it.
Bob
That looks Ok apart from the redirect URL which has some junk left in it.
index.php?option=com_chronoforms&chronoforms/?chronoform=ChurchFamilyMemberList&fid={$fid}
should presumably beindex.php?option=com_chronoforms&chronoform=ChurchFamilyMemberList&fid={$fid}
though as $fid isn't defined here so it will presumably display an empty form with the urlindex.php?option=com_chronoforms&chronoform=ChurchFamilyMemberList&fid=
Bob
Bob,
The code never seems to execute.
It doesn't delete the record and it stays on the DeleteMember page rather than redirecting.
I had taken out the fid code, but it didn't work with the code in it either.
I will put the fid code back and try it again.
Thanks
The code never seems to execute.
It doesn't delete the record and it stays on the DeleteMember page rather than redirecting.
I had taken out the fid code, but it didn't work with the code in it either.
I will put the fid code back and try it again.
Thanks
Bob,
Here is the full code with the fid in it:
It doesn't execute the redirect and it doesn't even do the echo of the query string.
Not sure what I am missing.
Here is the full code with the fid in it:
<?php
$fid = JRequest::getInt('fid', '', 'get');
$cf_id = JRequest::getInt('cf_id', '', 'get');
$db =& JFactory::getDBO();
$query = "
DELETE
FROM `cbc_chronoforms_data_churchmembers`
WHERE `cf_id` = '{$cf_id}' ;
";
echo $query
$db->setQuery($query);
$db->query();
$mainframe =& JFactory::getApplication();
$mainframe->redirect('index.php?option=com_chronoforms&chronoform=ChurchFamilyMemberList&fid={$fid}');
?>
It doesn't execute the redirect and it doesn't even do the echo of the query string.
Not sure what I am missing.
Hi jhainsworth,
Try setting Error Reporting to Maximum temporarilty to see if there is a PHP error - though the code looks Ok to me except for this line
Do you have a Show HTML action for this form?
Bob
Try setting Error Reporting to Maximum temporarilty to see if there is a PHP error - though the code looks Ok to me except for this line
$mainframe->redirect('index.php?option=com_chronoforms&chronoform=ChurchFamilyMemberList&fid={$fid}');
which needs double quotes to get the {$fid} to work.Do you have a Show HTML action for this form?
Bob
Hi Bob,
I don't have a show HTML action. This is my first custom form and I didn't know I could do wizard actions in a custom form.
How do I do that?
I don't have a show HTML action. This is my first custom form and I didn't know I could do wizard actions in a custom form.
How do I do that?
Hi jhainsworth,
Save & Close the form then click the Wizard Edit link and you have all the usual tabs except that the preview window is blocked.
Bob
Save & Close the form then click the Wizard Edit link and you have all the usual tabs except that the preview window is blocked.
Bob
OK, I added a show html action to the onload event, but nothing changed. My code still doesn't get executed.
Hi Bob,
I know I must be missing sometihing simple.
If I comment out the last 4 lines of code, that actually work with the db and mainframe objects then it does display the delete statement.
What could I be missing?
I know I must be missing sometihing simple.
If I comment out the last 4 lines of code, that actually work with the db and mainframe objects then it does display the delete statement.
<?php
$fid = JRequest::getInt('fid', '', 'get');
$cf_id = JRequest::getInt('cf_id', '', 'get');
$db =& JFactory::getDBO();
$query = "
DELETE
FROM `cbc_chronoforms_data_churchmembers`
WHERE `cf_id` = '{$cf_id}' ;
";
echo $query
# $db->setQuery($query);
# $db->query();
# $mainframe =& JFactory::getApplication();
# $mainframe->redirect('index.php?option=com_chronoforms&chronoform=ChurchFamilyMemberList&fid={$fid}');
?>
What could I be missing?
I have finally got the delete to work.
After putting in the show html action and doing some debuging, I found that I had a line that didn't have a ";" at the end of it.
correct code is
Thanks Bob for all your patient support.
After putting in the show html action and doing some debuging, I found that I had a line that didn't have a ";" at the end of it.
correct code is
<?php
$fid = JRequest::getInt('fid', '', 'get');
$cf_id = JRequest::getInt('cf_id', '', 'get');
$db =& JFactory::getDBO();
$query = "
DELETE
FROM `cbc_chronoforms_data_churchmembers`
WHERE `cf_id` = '{$cf_id}' ;
";
$db->setQuery($query);
$db->query();
$mainframe =& JFactory::getApplication();
$mainframe->redirect("index.php?option=com_chronoforms&chronoform=ChurchFamilyMemberList&fid={$fid}");
?>
Thanks Bob for all your patient support.
Hi jhainsworth,
Great - good to see you got it working. Bugs like a missing ; are often the easiest to make and the hardest to track down.
Bob
Great - good to see you got it working. Bugs like a missing ; are often the easiest to make and the hardest to track down.
Bob
This topic is locked and no more replies can be posted.