Trouble with the select box, and errors on frontend

busterocaps 31 Dec, 2011
Hi,
I'm attempting my first form, and I've gotten stuck at one feature I'd like to have. I have one form which displays a list of users, and an edit link. I constructed this form using the multidb loader tutorial. I have another form which allows the editing, which is passed the users id through the 'token' parameter just like in the tutorial.

My first problem is that the edit link isn't constructed properly on the frontend, but it's right in the code. In my code I have
<td><a href="index.php?option=com_chronoforms&chronoform=user_editor&token=<?php echo $detail['user_id']; ?>">Edit</a></td>

but the link shows up in the frontend like this:
http://testingsite.dogs-o-war.com/component/chronoforms/?chronoform=user_editor&token=69


My second problem is on my edit form, I have a select box that has a list of seven items. One of those items is brought in from the database, and needs to be selected by default. For example, the field id is cb_rank. In the database, there is a entry called cb_rank that could be any one of 8 different ranks. I created the select box with all of the corresponding options, but I have no idea how to change the selected property after the dbrecord load so it matches what is being pulled from the database.

My last issue has to do with the edit form. I get a bunch of warnings when it displays on the frontend, but only when I pass it the database item.
Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 165

I hope you can help, I'm at a bit of a roadblock at the moment!
Thanks!
GreyHead 31 Dec, 2011
Hi busterocaps,

The link looks as though you have Joomla! SEF turned on and it's doing it's 'stuff' with the URL. All the key info is there and it should still work OK.

The RePublish problem may be a bug in ChronoForms that's documented in the RC2.0 bugs list. Please upgrade to RC 3.0 and check if that fixes the problem.

Bob
busterocaps 01 Jan, 2012
I'm pretty sure I just screwed up my install.🙂 I misread the instructions and didn't uninstall the previous version first. I had 2 chronoforms under extend. I uninstalled rc2, but I think it's already screwed. The component isn't listed in the uninstall manager either, so is there a way to manually uninstall?

My chronoforms no longer seems to have the 'drag and drop' functionality. I only have the standard list of form components(text field, heading, that stuff). I don't see the event stuff or anything that I had before, and I can't restore my forms from the previous version.
GreyHead 01 Jan, 2012
Hi busterocaps ,

You can (and should) upgrade from CFv4 RC2.0 to RC3.0 by installing the new version over the existing one. There is no need to uninstall.

You can manually uninstall by removing the administrator/components/com_chronoforms/ and components/com_chronoforms/ folders and all their content; removing any chronoforms tables in the database and editing the Joomla! component, menu (and possibly other ???) tables to remove any ChronoForms records.

If the drag and drop is not working then most likely you are using Joomla! 1.5 and don't have the MooToosl upgrade plug-in enabled.

Bob
busterocaps 01 Jan, 2012
Happy New Year!

I think I figured out where I went wrong. On the downloads page I grabbed http://chronoengine.com/downloads/chronoforms/chronoforms-j1/component/131-chronoformsv3-2-0.html and installed that. That creates something called chronocontact which was what I was using to try and do forms. I have since uninstalled everything, then put http://chronoengine.com/downloads/chronoforms/chronoforms-j1/component/177-chronoformsv4rc3-0j1-5.html on my site and I'm back in business. Unfortunately I have the same issues, however! lol

SEF problem - when I have SEF enabled the links from my main form to my user edit form get changed and no longer work. Turning of SEF solves that issue, but I don't think I should have to do that...

Select box - How do I use the data returned from the database query to updated the 'selected' property. Seems like I should be able to use a variable, but I can't figure out the syntax

Errors on frontend - Warning: in_array() [function.in-array]: Wrong datatype for second argument in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php on line 190 Seems that the linenumber changed with the upgrade but nothing else

Thanks!
BTW, I do have mootools 1.2.5 enabled, and now that I'm using the right component I'm back to normal.
busterocaps 02 Jan, 2012
I tried to use a custom element to do the select box with, using this code
<?php 
switch($form->data['cb_rank']
{     
case "Recruit":
echo '<select name="cb_rank">
<option value="Recruit" selected="selected">Recruit</option>
<option value="Private">Private</option>
<option value="Corporal">Corporal</option> 
<option value="Sergeant">Sergeant</option>
<option value="Master Sergeant">Master Sergeant</option>
<option value="Lieutenant">Lieutenant</option>
<option value="Captain">Captain</option>';break;
case "Private":
echo '<select name="cb_rank">
<option value="Recruit">Recruit</option>
<option value="Private"selected="selected">Private</option>
<option value="Corporal">Corporal</option> 
<option value="Sergeant">Sergeant</option>
<option value="Master Sergeant">Master Sergeant</option>
<option value="Lieutenant">Lieutenant</option>
<option value="Captain">Captain</option>';break;
case "Corporal":
echo '<select name="cb_rank">
<option value="Recruit">Recruit</option>
<option value="Private">Private</option>
<option value="Corporal"selected="selected">Corporal</option> 
<option value="Sergeant">Sergeant</option>
<option value="Master Sergeant">Master Sergeant</option>
<option value="Lieutenant">Lieutenant</option>
<option value="Captain">Captain</option>';break;
case "Sergeant":
echo '<select name="cb_rank">
<option value="Recruit">Recruit</option>
<option value="Private">Private</option>
<option value="Corporal">Corporal</option> 
<option value="Sergeant"selected="selected">Sergeant</option>
<option value="Master Sergeant">Master Sergeant</option>
<option value="Lieutenant">Lieutenant</option>
<option value="Captain">Captain</option>';break;
case "Master Sergeant":
echo '<select name="cb_rank">
<option value="Recruit">Recruit</option>
<option value="Private">Private</option>
<option value="Corporal">Corporal</option> 
<option value="Sergeant">Sergeant</option>
<option value="Master Sergeant"selected="selected">Master Sergeant</option>
<option value="Lieutenant">Lieutenant</option>
<option value="Captain">Captain</option>';break;
case "Lieutenant":
echo '<select name="cb_rank">
<option value="Recruit">Recruit</option>
<option value="Private">Private</option>
<option value="Corporal">Corporal</option> 
<option value="Sergeant">Sergeant</option>
<option value="Master Sergeant">Master Sergeant</option>
<option value="Lieutenant"selected="selected">Lieutenant</option>
<option value="Captain">Captain</option>';break;
case "Captain":
echo '<select name="cb_rank">
<option value="Recruit">Recruit</option>
<option value="Private">Private</option>
<option value="Corporal">Corporal</option> 
<option value="Sergeant">Sergeant</option>
<option value="Master Sergeant">Master Sergeant</option>
<option value="Lieutenant">Lieutenant</option>
<option value="Captain"selected="selected">Captain</option>';break;
}
?>

But that gives me a parse error
Parse error: syntax error, unexpected T_CASE in /home/content/07/8253607/html/testingsite/components/com_chronoforms/libraries/includes/data_republish.php(24) : eval()'d code on line 21
So I guess I'll wait to see what you say!🙂
GreyHead 02 Jan, 2012
Hi busterocaps,

You are missing the closing ) from the second line:
switch( $form->data['cb_rank'] )


ChronoForms should do this automatically for you if you have a 'standard' select box input and 'Republish form data' is set to Yes in the Show HTML action.

Bob
busterocaps 02 Jan, 2012
Ok, for some reason when I tried using that select box before it didn't work. Now it does, so I'm good there. I tried to save the record and got this error:
Tablecomprofiler::store failed - Duplicate entry '69' for key 2 SQL=INSERT INTO `jos_comprofiler` ( `user_id`,`cb_xbox`,`cb_branch`,`cb_rank`,`cb_officernotes`,`cb_lastactive`,`cb_lastpromotiondate` ) VALUES ( '69','me bbq man','Maelstrom','Sergeant','test note','2011-12-18','2011-08-23' )
Shouldn't it be overwriting instead of trying to create a new record?

Thanks
busterocaps 03 Jan, 2012
I found that I had to change the table from 'indexed' in sql. Thanks for all your help, I think this is going to work!
:)
This topic is locked and no more replies can be posted.