Primary Key getting blanked out

peverheart 01 May, 2009
I am having a problem when adding a child of a user on this page. This is the code within the CC Record Edit Template.
<?php
$user = JFactory::getUser();
?>
<table border="" cellpadding="1" cellspacing="1">
<caption>Add Child for <?php echo $user->name ?></caption>
  <tr>
    <td>Child Name:</td><td><input type="text" name="Name" size="25" value=""></td>
  </tr>
   <tr>
    <td>Birth Date:</td><td><input type="text" name="BIRTH_DATE" size="25" value=""></td>
  </tr>
</table>
<input type="hidden" name="ID" value="">
<input type="hidden" name="USER_ID" value="<?php echo $user->id ?>">

The Table this entry gets made to has a 2 column Primary Key, ID & USER_ID. For some reason , the USER_ID is being duplicated , within the source of the page I see this:

<table border="" cellpadding="1" cellspacing="1">
<caption>Add Child for Sue Smith</caption>
  <tr>
    <td>Child Name:</td><td><input type="text" name="Name" size="25" ></td>

  </tr>
   <tr>
    <td>Birth Date:</td><td><input type="text" name="BIRTH_DATE" size="25" ></td>
  </tr>
</table>
<input type="hidden" name="ID" >
<input type="hidden" name="USER_ID" value="71">            <input type="hidden" name="option" value="com_chronoconnectivity">
            <input type="hidden" name="USER_ID" value="0" />
        </form>


USER_ID is correct the first time(71), but 0 the second time. I do not know where this output is occurring, I did not put it anywhere. I really need that User_id to be correct.

Can you figure this one out?
GreyHead 01 May, 2009
Hi peverheart,

ChronoConnectivity automatically adds a hidden field to store the unique id for the record. That's the second one that you see. Why it is zero I'm not so sure - you'd usually only see that if the current user was a guest.

I'm not expert in ChronoConnectivity but I don't think that it can handle a dual-field primary key correctly.

Bob

PS Make that $user =& JFactory::getUser(); to save some memory.
This topic is locked and no more replies can be posted.