Forums

updating existing record?

SilentCid 01 Jun, 2011
Here is the problem I'm in and been searching my answers here on the boards. Stuff I found were helpful and it helped me a lot, but I am stuck on the part where updating my data I submit on to save to an existing table, seems like it doesn't happen. Profile plugin populates everything and I have three extra fields that are blank for the person going to the form can update later and put it in a existing record. The form is connected to the database and saving is on.

I do have cf_id as the primary key and added this to the form. Profile is set to edit 'yes'.
<input name="cf_id" value="" type="hidden" />


<input name="cf_id" value="" type="hidden" />

<!--This part pulls data from jos_legion_members -->
<div class="form_item">
  <div class="form_element cf_heading">
    <h1 class="cf_text">Full User Information</h1>
  </div>
  <div class="cfclear"> </div>
</div>


<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Username:</span> {user_name} 
</div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Character:</span>
{Character}
</div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Age:</span>{age} </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">Time Zone: </span>{time_zone} </div>
  <div class="cfclear"> </div>
</div>


<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">How {user_name} heard of LEGION:</label>
    <textarea class="cf_inputbox" rows="3" id="text_4" title="" cols="30" name="text_4" >{hear_legion}</textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">{user_name} prior guilds:</label>
    <textarea class="cf_inputbox" rows="3" id="text_6" title="" cols="30" name="text_6" >{guild_prior}</textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">What  {user_name} believes is LEGION material:</label>
    <textarea class="cf_inputbox" rows="3" id="text_7" title="" cols="30" name="text_7" >{legion_material}</textarea>
    
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">PvP Grade:</span> {PvP_grade}</div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">{user_name} has read LEGION's code.</span> </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_text"> <span class="cf_text">{user_name} is aware of LEGION's Vent and Forums activity condition.</span> </div>
  <div class="cfclear"> </div>
</div>

<!-- This is the blank fields that the user needs to edit later on.  -->
<div class="form_item">
  <div class="form_element cf_heading">
    <h1 class="cf_text">Recruitment Inspection</h1>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">On week one {user_name} visited forums on:</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="check_forums_on_date1" name="check_forums_on_date1" type="text" value='<?php echo $d->check_forums_on_date1; ?>' />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">On week two {user_name} visited forums on:</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="check_forums_on_date2" name="check_forums_on_date2" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">On week three {user_name} visited forums on</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="check_forums_on_date3" name="check_forums_on_date3" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Vent inspection date 1:</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="on_vent_while_ingame1" name="on_vent_while_ingame1" type="text" />
  <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" alt="" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Vent inspection date 2: :: If not on vent while in-game make sure they had valid reasons for it. If reasons are not valid put the word '"FAIL" in the box without the quotes.</div>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">Vent inspection date 2:</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="on_vent_while_ingame2" name="on_vent_while_ingame2" type="text" />
  <a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" alt="" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Vent inspection date: :: If not on vent while in-game make sure they had valid reasons for it. If reasons are not valid put the word '"FAIL" in the box without the quotes.</div>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textarea">
    <label class="cf_label" style="width: 150px;">Additional comments, concerns, and/or recommendations:</label>
    <textarea class="cf_inputbox" rows="3" id="comments title="" cols="30" name="comments"></textarea>
<a class="tooltiplink" onclick="return false;"><img height="16" border="0" width="16" class="tooltipimg" alt="" src="components/com_chronocontact/css/images/tooltip.png"/></a>
				<div class="tooltipdiv">Additional comments, concerns, and recommendations: :: When making a comment, concerns, and/or recommendations, please put your username on one line only in this format: ---User Name---</div>
  </div>
  <div class="cfclear"> </div>


    
  </div>
  <div class="cfclear"> </div>
</div>


<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" type="submit" onclick="window.parent.document.getElementById('sbox-window').close();"/>
  </div>
  <div class="cfclear"> </div>
</div>


Form is displayed from my view details link on ChronoConnectivity in a light box. So I guess I'm still missing something that makes the record be updated?
SilentCid 06 Jun, 2011
I'm hoping that I'm not being too difficult with my question. I know easier ones get more of an priority than the complex ones.
GreyHead 06 Jun, 2011
Hi silentcid,

Does the form save correctly without the lightbox?

When you look at the page source is the cf_id value correctly included?

Bob
SilentCid 06 Jun, 2011
The cf_id does pulls the right value and without the lightbox it still doesn't save. Should I have more stuff on the onsubmit box?
SilentCid 07 Jun, 2011
    Form passed first SPAM check OK
    Form passed the submissions limit (if enabled) OK
    Form passed the Image verification (if enabled) OK
    Form passed the server side validation (if enabled) OK
    $_POST Array: Array ( [cf_id] => 13 [text_4] => [text_6] => [text_7] => [check_forums_on_date1] => [check_forums_on_date2] => [check_forums_on_date3] => [on_vent_while_ingame1] => [on_vent_while_ingame2] => [comments] => test [button_19] => Submit [af16b3afccc844c8cac0a72e51d5a2af] => 1 [1cf1] => 3707ac9060e91d49eb344123c588611d [chronoformname] => Single_Record )
    $_FILES Array: Array ( )
    Form passed the plugins step (if enabled) OK
    Debug End


Here's the debug of it. text_4, text_6, and text_7 were just text area or text boxes to display data only in them. I filled out the text area box called comments with the word test to see if it will save.
SilentCid 10 Jun, 2011
Must be getting something wrong I still can't get it to save. Is there a tutorial I can look at and see if what I have wrong?
GreyHead 10 Jun, 2011
Hi silentcid,

If there is a DB Connection enabled, the table has a primary key named 'cf_id' and there is an existing record in the table with a cf_id of 13 then this record should be updated.

By all means email or PM me the site URL and a SuperAdmin login and I'll take a quick look.

Bob
GreyHead 11 Jun, 2011
Hi silentcid,

Fixed: the DB Connection is set to 'Before Email'; with this setting 'Send Emails' must be set to 'Yes' on the form generasl tab or the code does not run. It's just an odd historic quirk of ChronoForms that the Before Email options only run if the Emails are anabled.

Bob

PS There are a number of mismatched inputs between the form and the table so only a few inputs are saved but I guess that you know that.
SilentCid 11 Jun, 2011
Wow I wouldn't would have figured that out with the Before Email and the Send Email setting. I been pulling my hair figuring out that one. The others inputs were going to be set to disable I'd just wanted to have a certain part updated with the form. When things weren't working the way I'd need it. I took out the disabled part in all the inputs thinking it was effecting it some how.

Thanks GreyHead for your help.
dj__spawn 19 Jul, 2011
Hi,
Really sorry, but i cant manage to find that two params :
- "before email"...
- "send email"...

Where are they? I'm using the Standard Wizard, and i dont find that fields anywhere...
Thanks for helping!
Spawn
GreyHead 19 Jul, 2011
hi dj__spawn,

Which version of ChronoForms are you using? You can find the version from Site Admin | Extensions | Install/Uninstall | Components in Joomla! 1.5 or Site Admin | Extensions | Extension Manager | Manage in Joomla! 1.6.

Bob
dj__spawn 20 Jul, 2011
Hi,
My current version : ChronoForms Component 4.0 RC1.9 over Joomla1.6.5.

Spawn
GreyHead 20 Jul, 2011
Hi spawn,

That post refers to settings in ChronoForms v3.2. They don't exist in ChronoForms v4.

Bob
dj__spawn 21 Jul, 2011
Hi bob,
ok. But I've got the same problem as described in this post.
I mean when I'm trying to load a form basing on DB values (extracted from DataBase, basing on a "cf_uid" equivalent token), my hidden field "cf_id" never loads the right value... However, my other fields (name, email etc...) are well loaded.

An exemple of result HTML code :
<input id="cf_id" type="hidden" value="" name="cf_id" />
<div class="ccms_form_element cfdiv_text" id="nom_container_div"><label>Nom</label><input maxlength="150" size="30" class=" validate['required','nodigit']" title="Le champ NOM doit être renseigné!" type="text"  name="input_nom" value="nom_correct"  />

You could see that "cf_id" value is "", whereas "input_nom" value is well DB Loaded (="nom_correct").

Spawn
dj__spawn 22 Jul, 2011
Hi bob,
OK, SOLVED.
That was a problem with MySQL : the indexed cf_id primary key was corrupted!
I solved it by fixing the DB with automatic checking...

Thanks for your replies.
Your ChronoForms engine is a really good and impressive job!

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