
<h3 style="margin-left:50px;">Edition du projet</h3>
<div id="mainEdit"><br/>
[[getCase]]
[[updateCase2db]]
[!eForm? &noemail=`true` &formid=`updateCaseForm` &eFormOnBeforeMailSent=`updateCase2db` &tpl=`form_edition` &thankyou=`updateFormResult` &pos=`[+positioncase+]` &clientname=`[+clientname+]` &title =`[+titlecase+]` &text=`[+textcase+]` &type=`[+typecase+]` &link=`[+linkcase+]` &typeTitle=`[+typetitlecase+]` &print=`[+tagprint+]` &web=`[+tagweb+]` !]
...
$modx->setPlaceholder('positioncase', mysql_escape_string($irow['position']));
$modx->setPlaceholder('clientname', mysql_escape_string($irow['clientname']));
$modx->setPlaceholder('titlecase', mysql_escape_string($irow['title']));
$modx->setPlaceholder('textcase', mysql_escape_string($irow['text']));
$modx->setPlaceholder('typecase', mysql_escape_string($irow['projectType']));
$modx->setPlaceholder('linkcase', mysql_escape_string($irow['projectLink']));
$modx->setPlaceholder('typetitlecase', mysql_escape_string($irow['projectTypeTitle']));
$modx->setPlaceholder('tagprint', $print);
$modx->setPlaceholder('tagweb', $web);
return;
?>[+validationmessage+]
<form method="post" class="jNice" name="updateCaseForm" enctype="multipart/form-data" action="[~[*id*]~]]">
<table id="editCaseForm" >
<tr>
<td>
<label for="posPrj">Position du projet : </label><br/>
<input type="text" name="posPrj" id="posPrj" tabindex="8" value="[+positioncase+]" />
</td>
</tr>
<tr>
<td><label for="clientname">Nom du Client : </label><br/>
<input type="text" name="clientname" id="clientname" tabindex="2" value="[+clientname+]" />
</td>
</tr>
<tr>
<td>
<label for="titleTextPrj">Titre Descriptif : </label><br/>
<input type="text" name="titleTextPrj" id="titleTextPrj" size ="50" tabindex="3" value="[+titlecase+]" />
</td>
<td>
<label for="descriptif">Descriptif : </label><br/>
<textarea cols="47" rows="4" name="descriptif" id="descriptif" tabindex="4" >[+textcase+]</textarea>
</td>
</tr>
<tr>
<td>
<label for="typePrj">Type du projet : </label><br/>
<input type="text" name="typePrj" id="typePrj" tabindex="5" size ="50" value="[+typecase+]" />
</td>
<td>
<label for="linkPrj">Lien du projet : </label><br/>
<input type="text" name="linkPrj" id="linkPrj" tabindex="6" value="[+linkcase+]" />
</td>
</tr>
<tr>
<td>
<label for="titrePrj">Entête Projet : </label><br/>
<input type="text" name="titrePrj" id="titrePrj" tabindex="7" value="[+typetitlecase+]" />
</td>
</tr>
<tr>
<td>
<p><input type="radio" id="radio_print" name="radio_cat" tabindex="5" size="1" value="print" [+tagprint+] onclick ="get_radio_value();" />
<label for="radio_print" class="checkbox">Print </label>
<input type="radio" id="radio_web" name="radio_cat" tabindex="6" size="1" value="web" [+tagweb+] onclick ="get_radio_value();" />
<label for="radio_web" class="checkbox">Web</label>
</p>
</td>
</tr>
<!-- Bouton Submit -->
<tr><td><input type="submit" value="sauvegarder" name="saveBtn" class="button-submit" /></td></tr>
</table>
</form>

function populate_form(&$fields, &$templates)
{
if (!count($_POST) > 0)
{
// get $value from database and format custom html
$templates['tpl']=str_replace('[+my_placeholder+]', $value, $templates['tpl']);
// or set field values
$fields['my_field_name'] = $value;
}
}
[!getCase!] [[updateCase2db]] [!eForm? &noemail=`true` &formid=`updateCaseForm` &eFormOnBeforeMailSent=`updateCase2db` &tpl=`form_edition` &thankyou=`updateFormResult` &pos=`[+positioncase+]` &clientname=`[+clientname+]` &title =`[+titlecase+]` &text=`[+textcase+]` &type=`[+typecase+]` &link=`[+linkcase+]` &typeTitle=`[+typetitlecase+]` &print=`[+tagprint+]` &web=`[+tagweb+]` &eFormOnBeforeFormParse=`populate_form`!]

. but it’s ok for that.<?php
function populate_form(&$fields, &$templates){
if (!count($_POST) > 0)
{
$fields['posPrj'] = $posForm;
$fields['clientname'] = $clientNameForm;
$fields['titleTextPrj'] = $titleForm ;
$fields['descriptif'] = $textForm ; // pb here
$fields['typePrj'] = $typeForm;
$fields['linkPrj'] = $linkForm ;
$fields['titrePrj'] = $titleTypeForm ;
$templates['tpl']=str_replace('[+tagprint+]', $printTagForm, $templates['tpl']); // pb here
$templates['tpl']=str_replace('[+tagweb+]', $webTagForm, $templates['tpl']); // pb here
}
}
function updateCase2db ( &$fields )
{
/*---------------------------------------------------------------
updateCase2db from eform2db ( pixelChutes )
---------------------------------------------------------------
Requirements:
eForm 1.4+
---------------------------------------------------------------
---------------------------------------------------------------*/
// Bring needed resources into scope
global $modx, $table_prefix;
$posForm= isset($pos) ? $pos : 0;
$clientNameForm = isset($clientName) ? $clientName : "";
$titleForm = isset($title) ? $title : "";
$textForm = isset($text) ? $text : "";
$typeForm = isset($type) ? $type : "";
$linkForm = isset($link) ? $link : "";
$titleTypeForm = isset($typeTitle) ? $typeTitle : "";
$printTagForm = isset($print) ? $print : "";
$webTagForm = isset($web) ? $web : "";
// Init our array
$dbTable = array();
// Insert field/value pairs to insert/update in our table
$dbTable[position] = $posForm; //position du projet
$dbTable[clientname] = $clientNameForm; // client Name Field
$dbTable[title] = $titleForm; //titre text prj
$dbTable[text] = $textForm; //descriptif
$dbTable[projectType] = $typeForm; //type projet
$dbTable[projectLink] = $linkForm; //lien du projet
$dbTable[projectTypeTitle] = $titleTypeForm; //titre "projet"
// radio buttons "web" / "print"
// $printTagForm = "checked" or ""
if ($printTagForm !=""){
$dbTable[tags] = $printTagForm;
}
elseif ($webTagForm !=""){
$dbTable[tags] = $webTagForm;
}
// Run the db insert query
$dbQuery = $modx->db->update( $dbTable, 'cases' );
return true;
}
?>
[!updateCase2db!] [!eForm? &noemail=`true` &formid=`updateCaseForm` &eFormOnBeforeMailSent=`updateCase2db` &eFormOnBeforeFormParse=`populate_form` &tpl=`form_edition` &thankyou=`updateFormResult` &print=`[+tagprint+]` &web=`[+tagweb+]`&idCase=`[+caseId+]!]
<?php
function populate_form(&$fields, &$templates){
global $modx;
if (!count($_POST) > 0)
{
$caseId = $_REQUEST["idPrj"];
$modx->setPlaceholder('caseId', $caseId);
$modx->db->connect();
$res = $modx->db->select("*", 'cases',"id='" . $caseId."'");
$irow = $modx->db->getRow($res);
// categorie 'web' 'print'
if ($irow ['tags'] =="web"){
$web ='checked';
$print ="";
}
else {
$web ="";
$print ='checked';
}
$caseId = $_REQUEST["idPrj"];
$modx->setPlaceholder('caseId', $caseId);
$modx->setPlaceholder('tagprint', $print);
$modx->setPlaceholder('tagweb', $web);
$fields['posPrj'] = mysql_escape_string($irow['position']);//$posForm;
$fields['clientname'] = mysql_escape_string($irow['clientname']);//$clientNameForm;
$fields['titleTextPrj'] = mysql_escape_string($irow['title']);//$titleForm ;
//$fields['desc'] = mysql_escape_string($irow['text']);//$textForm ;
$fields['typePrj'] = mysql_escape_string($irow['projectType']);//$typeForm;
$fields['linkPrj'] = mysql_escape_string($irow['projectLink']);//$linkForm ;
$fields['titrePrj'] = mysql_escape_string($irow['projectTypeTitle']);//$titleTypeForm ;
$templates['tpl']=str_replace('[+textcase+]', mysql_escape_string($irow['text']), $templates['tpl']);
$templates['tpl']=str_replace('[+tagprint+]', $print, $templates['tpl']);
$templates['tpl']=str_replace('[+tagweb+]', $web, $templates['tpl']);
}
}
function updateCase2db ( &$fields )
{
/*---------------------------------------------------------------
updateCase2db from eform2db ( pixelChutes )
---------------------------------------------------------------
Requirements:
eForm 1.4+
---------------------------------------------------------------
---------------------------------------------------------------*/
// Bring needed resources into scope
global $modx, $table_prefix;
$caseId = isset($idCase) ? $idCase: 1;
$printTagForm = isset($print) ? $print : "";
$webTagForm = isset($web) ? $web : "";
// Init our array
$dbTable = array();
// Insert field/value pairs to insert/update in our table
$dbTable[position] = $fields[posPrj]; //position du projet
$dbTable[clientname] = $fields[clientname]; // client Name Field
$dbTable[title] = $fields[titleTextPrj]; //titre text prj
$dbTable[text] = $fields[descriptif]; //descriptif
$dbTable[projectType] = $fields[typePrj]; //type projet
$dbTable[projectLink] = $fields[linkPrj]; //lien du projet
$dbTable[projectTypeTitle] = $fields[titrePrj]; //titre "projet"
$dbTable[tags] = $fields[radio_cat]; // "web" / "print"
// Run the db update query
$dbQuery = $modx->db->update( $dbTable, 'cases' , 'id = "' . $caseId . '"');
echo $dbQuery;
return true;
}
?>