form not posting anything to uid column

marklandry 26 Mar, 2012
Hi
I have a form that's not posting anything to the UID column
It's probably something I screwed up as it used to work
Is there any way to check this form/add something so that I can get it to post a uid?
Or do I need to start over with a new form?
Thanx for your help

Mark
GreyHead 26 Mar, 2012
Hi Mark,

Impossible to tell from here. Which version of CF is this? and do you really need the uid?

Bob
marklandry 26 Mar, 2012
version 4
I've setup an editing feature which uses the uid as a token to pull up the form to be edited.
below is the code I'm using in a custom code event - works fine for entries that have a uid...

<?php
  $mine = $_GET["mine"];
  $id = $_GET["id"];
  
?>
<style type="text/css">
       tr:nth-child(even) {
             background: #222425
       }
</style>
<table style="color:#818181;">
    <tr>
         <th style="padding-right:10px;">Date</th>
         <th style= "padding: 0px 5px 0px 5px">Fairways</th>
         <th style= "padding: 0px 5px 0px 5px">Greens</th>
         <th style= "padding: 0px 5px 0px 5px">Putts</th>
         <th style= "padding: 0px 5px 0px 5px">Penalties</th>
         <th style= "padding: 0px 5px 0px 5px">Score</th>
         <th style= "padding: 0px 0px 0px 5px">Edit</th>
    </tr>
    <?php
    foreach($form->data['UserDetails'] as $detail):
    ?>
       <tr>
         <td style="text-align:center;"><?php echo $detail['date_0'];?></td>
         <td style="text-align:center;"><?php echo $detail['fairways'];?></td>
         <td style="text-align:center;"><?php echo $detail['greens'];?></td>
         <td style="text-align:center;"><?php echo $detail['putts'];?></td>
         <td style="text-align:center;"><?php echo $detail['penalties'];?></td>
         <td style="text-align:center;"><?php echo $detail['totalRound'];?></td>
         <td style="text-align:center;">
           <?php if ($mine==1):?>
         <a href="index.php?option=com_chronoforms&chronoform=scratchtracker_edit&token=<?php echo $detail['uid'];?>&tmpl=component">Edit</a>
         <?php elseif ($mine==0):?>
               X
         <?php endif;?>
         </td>
       </tr>
     <?php
        endforeach;
     ?>

</table>
GreyHead 26 Mar, 2012
Hi Mark,

In v4 it's cf_uid. If you have a cf_uid or uid input in your form it may be over-riding the automatic calculation. The code to generate a new one is
$form->data['cf_uid'] = md5(uniqid(rand(), true));


Bob
marklandry 26 Mar, 2012
That's weird,
In this joomla install I've got about 30 forms, most of which have db update events that created a "uid" column, not a "cf_uid" column...

I don't have any custom code to update the column but I'll try what's above
Thanx

mark
marklandry 26 Mar, 2012
I think what happened is that I'm using a database that was setup under v3 and trying to connect to it with v4 forms.... for the record
marklandry 26 Mar, 2012
that was it, I changed uid to cf_uid and it's posting now
Can I get the v4 column name for ip address as well?
Thanx

Mark
GreyHead 26 Mar, 2012
Hi Mark,

cf_ipaddress

Bob
This topic is locked and no more replies can be posted.