Edit Issue - Form name can NOT be empty

aharsha 28 Mar, 2013
Hello. Very newbie here and attempting to follow the V4 tutorials. Came across an issue on the multi-record-loader. I have followed step for step and I am all good up until testing the form. I can see the profession and the edit link and it has edit next to all the entries I added to the DB. However, when I click on edit, I get the Form name can NOT be empty. It will not launch the corresponding form for the record that I am attepting to edit. What could I be missing here?

Thank you for your help.
GreyHead 29 Mar, 2013
Hi aharsha,

What is the URL you have in the table Edit link?

What URL do you see in your browser when you click the link?

Bob
aharsha 30 Mar, 2013
http://localhost/index.php?option=com_chronoforms&tmpl=component&chronoform=list_data


When you click on one of the choices (I've made four entries into the DB), I get:
http://localhost/index.php/component/chronoforms/?choronoform=user_details&token=d5b180b1a53f5d555e6a3be8bc632300


Each choice has a different token so it is pulling the correct data, it just doesn't want to launch the edit form.

Thanks for your help Bob.
aharsha 30 Mar, 2013
My ultimate goal in the end is to have a user register for the website (got that), fill a form to add a real estate property (got that), and allow that user and that user only to edit or delete said property addition. Once I get the edit form to load correctly, I think we'll be close but is editing viewing and editing by logged in user going to be possible?
GreyHead 30 Mar, 2013
HI aharsha,

There's a little typo in here
choronoform=user_details


Bob
aharsha 30 Mar, 2013
Forgive my newbieness but I don't see the typo. That is the name of the other form. Here is what I have in the custom code for the editor. It works up until I click edit. at what point in that code is it suppose to go and grab the user_details form? I followed the tutorial, was I suppose to add any other events other than the multi record loader and the custom code?

<table>
<?php
foreach ($form->data ['UserDetails'] as $detail) :
?>
<tr>
<td>Profession:<?php echo $detail ['Profession']; ?></td>
<td><a href="index.php?option=com_chronoforms&choronoform=user_details&token=<?php echo $detail ['cf_uid']; ?>">Edit</a></td>
</tr>
<?php
endforeach;
?>
</table

GreyHead 30 Mar, 2013
Hi aharsha,

Please look again.

Bob
aharsha 30 Mar, 2013
Wow.You are good. I fat fingered it. Great find!!!

Based on all of that, is there anything in code I'd need to change to make only the logged in user who entered it to be able to view and edit?

Tahnk you!!!
GreyHead 30 Mar, 2013
Hi aharsha,

I'd use the Authenticator action in the On Load event to make sure that the user was logged in; then get their ID from the Joomla! User object and use that to get their record from the database. This is about as reliable as you can get.

Please see this FAQ for more about User Info.

Bob
aharsha 31 Mar, 2013
Thanks Bob.

Next question for you. Using the hidden value in the form, I can edit the data and that is sent back to the DB. However, it only lets me edit the last one entered. In fact, when I hit edit now, all I see is the last one entered for any of them. It had worked before until I added the hidden value. Here is an example of the edit screen.

The url for #1 is index.php/component/chronoforms/?chronoform=user_details&token=d5b180b1a53f5d555e6a3be8bc632300.

The url for #2 is /index.php/component/chronoforms/?chronoform=user_details&token=d79a665201b194cf0dd6e9f6ea16db2a

However, when I click on #2, it is going to the url for #1.

Any idea why that would be?

Thanks again.
GreyHead 31 Mar, 2013
Hi aharsha,

Sorry, no idea :-(

What do you see in your browser web developer tools if you look at the GET data being returned when you click the link?

Bob
aharsha 01 Apr, 2013
My apologies but I'm not sure how I'd check that. If you dont mind :

Basically, the edit is only bringing up the very first record that was entered regardless of what you choose and I have no idea why.

Thank you sir.
GreyHead 01 Apr, 2013
Hi aharsha,

I can only suggest that the DB Record Loader isn't linking the token value to the record correctly? What settings do you have in it?

Bob
aharsha 01 Apr, 2013
I was following the tutorials for the most part witht he exception that I made a form that adds to the database and one with the token in it (the DB Record Loader tutorial). I had seen in other posts that you said these should be seperate. The settings I have in the DB record loader are as follows:

DB Field - cf_uid
Table - joom_choronoforms_Property
Request Param - token
Model ID - None
Load Under Model ID - No

Advanced Tab - Everything blank except where statement set to 2.

I then created another form with the db multi record loader (following the tutorial). Here are those settings:

All Blank except DB Table - joom_chronoforms_Property and Model ID - PropertyDetails. All other tabs are default.

On the custom code - Controller

Code:
<table>
<?php
foreach ($form->data ['PropertyDetails'] as $detail) :
?>
<tr>
<td>Property Address:<?php echo $detail ['Prop_Address']; ?></td>
<td><a href="index.php?option=com_chronoforms&chronoform=EditProperty&token=<?php echo $detail ['cf_uid']; ?>">Edit</a></td>
</tr>
<?php
endforeach;
?>
</table>


Something has to be doubleing up but I just dont know what.

Thank you.
aharsha 02 Apr, 2013
Was there something in that db record loader I have typed in wrong? Since it was the tutorial, was it just pulling the single entry for the example and I actually need to make a change in the settings to pull the other records?
aharsha 03 Apr, 2013
So do you see anything funky in my setup for the edit that would cause it not to link to the right cf_uid? i ran a debugger and it loads the token for one of the other records but it does not pull up the corresponding cf_uid. What exactly should be in that WHERE statement box? If I leave it blank, I get a 1064 error. Is this what is causing this thing to misfire?

DB Field - cf_uid
Table - joom_choronoforms_Property
Request Param - token
Model ID - None
Load Under Model ID - No

Advanced Tab - Everything blank except where statement set to 2.
This topic is locked and no more replies can be posted.