/xxx/www/assets/snippets/FDM/install/[snippet]select.php not found.




Yes I remove it because eForm can’t validate such generated fields, I forget to remove it from the install module.
/xxx/www/assets/snippets/FDM/install/[snippet]select.php not found.
(not tested but I will do) you make a call to FDM in the page you want the link (don’t forget &model and &parent) and in the model you make your call with &disableadd.
what if I don’t want to use the add/edit/unpublish button bar ? I mean : I would like to display a link, like "add an article" and the user (anonymous or not), is redirected to the add article page, without seeing the button bar. Is that possible ?
if I click on the add button, I get the form with all fields filled in with the content of the form page... Is that normal ? I mean that I get the FDM call in the content textarea.Normally I have escaped chunk, snippet, ... in content textarea, the problem come from utf8 I think, because I search for some string ( [[,[!, ... ) to comment them, so snippet call, and chunk, ... don’t appears, but with utf8 the problem as explained here (in french) is present.
You’re clear at least like me.
(If I’m not clear, i can speak french :p )

$snippet['select']['filename']='[snippet]select.php'; $snippet['select']['description']='Display a listbox of value in forms';

$url=$modx->makeUrl($docObj->Get('id'),'','&fdmaction=edit');
}
header('Location: '.$url); // dans all ok
exit;
break; $url=$modx->makeUrl($docObj->Get('id'),'','&fdmaction=edit');
}
$url=str_replace('&','&',$url);
header('Location: '.$url); // dans all ok
exit;
break; <?php
$docid=isset($value)?$docid:'214';
$field_name=isset($field_name)?$field_name:'documentTags';
function ParseIntputOptions($v) {
$a = array();
if(is_array($v)) return $v;
else if(is_resource($v)) {
while ($cols = mysql_fetch_row($v)) $a[] = $cols;
}
else $a = explode("||", $v);
return $a;
}
$rs = $modx->db->select("id, type, caption, description, elements, default_text", $modx->getFullTableName('site_tmplvars'), "name = '$field_name'");
$limit = mysql_num_rows($rs);
if ($limit != 1) { echo "TV с именем '$field_name' отсутствует, или произошло задвоение имен TV."; }
else {
$tvfields = mysql_fetch_assoc($rs);
$tvid = $tvfields['id'];
$field_type = $tvfields['type'];
$field_caption = $tvfields['caption'];
$field_description = $tvfields['description'];
$field_elements = $tvfields['elements'];
$field_default_text = $tvfields['default_text'];
}
$rs = $modx->db->select("value", $modx->getFullTableName('site_tmplvar_contentvalues'), "tmplvarid = '$tvid' and contentid = '$docid'");
$limit = mysql_num_rows($rs);
if ($limit != 1) {echo "Ошибка значения TV";}
else {
$field = mysql_fetch_assoc($rs);
$field_value = $field['value'];
}
$field_html ='';
switch ($field_type) {
case "text": // handler for regular text boxes
case "rawtext"; // non-htmlentity converted text boxes
case "email": // handles email input fields
case "number": // handles the input of numbers
$field_html .= '<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'" value="'.htmlspecialchars($field_value).'" style="width:100%" />';
break;
case "textareamini": // handler for textarea mini boxes
$field_html .= '<textarea id="tv'.$field_name.'" name="tv'.$field_name.'" cols="40" rows="5" style="width:100%">' . htmlspecialchars($field_value) .'</textarea>';
break;
case "textarea": // handler for textarea boxes
case "rawtextarea": // non-htmlentity convertex textarea boxes
case "htmlarea": // handler for textarea boxes (deprecated)
case "richtext": // handler for textarea boxes
$field_html .= '<textarea id="tv'.$field_name.'" name="tv'.$field_name.'" cols="40" rows="15" style="width:100%;">' . htmlspecialchars($field_value) .'</textarea>';
break;
case "date":
// select (dropdown)
case "dropdown":
$field_html .= '<select id="tv'.$field_name.'" name="tv'.$field_name.'" size="1">';
$index_list = ParseIntputOptions($field_elements);
while (list($item, $itemvalue) = each ($index_list))
{
list($item,$itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
if (strlen($itemvalue)==0) $itemvalue = $item;
$field_html .= '<option value="'.htmlspecialchars($itemvalue).'"'.($itemvalue==$field_value ?' selected="selected"':'').'>'.htmlspecialchars($item).'</option>';
}
$field_html .= "</select>";
break;
// select (listbox)
case "listbox":
$field_html .= '<select id="tv'.$field_name.'" name="tv'.$field_name.'" size="8">';
$index_list = ParseIntputOptions($field_elements);
while (list($item, $itemvalue) = each ($index_list))
{
list($item,$itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
if (strlen($itemvalue)==0) $itemvalue = $item;
$field_html .= '<option value="'.htmlspecialchars($itemvalue).'"'.($itemvalue==$field_value ?' selected="selected"':'').'>'.htmlspecialchars($item).'</option>';
}
$field_html .= "</select>";
break;
// multiple select
case "listbox-multiple":
$field_value = explode("||",$field_value);
$field_html .= '<select id="tv'.$field_name.'[]" name="tv'.$field_name.'[]" multiple="multiple" size="8">';
$index_list = ParseIntputOptions($field_elements);
while (list($item, $itemvalue) = each ($index_list))
{
list($item,$itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
if (strlen($itemvalue)==0) $itemvalue = $item;
$field_html .= '<option value="'.htmlspecialchars($itemvalue).'"'.(in_array($itemvalue,$field_value) ?' selected="selected"':'').'>'.htmlspecialchars($item).'</option>';
}
$field_html .= "</select>";
break;
// url input fields
case "url":
$urls= array(''=>'--', 'http://'=>'http://', 'https://'=>'https://', 'ftp://'=>'ftp://', 'mailto:'=>'mailto:');
$field_html ='<table border="0" cellspacing="0" cellpadding="0"><tr><td><select id="tv'.$field_name.'_prefix" name="tv'.$field_name.'_prefix" onchange="documentDirty=true; setVariableModified(\''.$field_name.'\');">';
foreach($urls as $k => $v){
if(strpos($field_value,$v)===false) $field_html.='<option value="'.$v.'">'.$k.'</option>';
else{
$field_value = str_replace($v,"",$field_value);
$field_html.='<option value="$v" selected="selected">'.$k.'</option>';
}
}
$field_html .='</select></td><td>';
$field_html .= '<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'" value="'.htmlspecialchars($field_value).'" width="100" /></td></tr></table>';
break;
// check boxes
case "checkbox":
$field_value = explode("||",$field_value);
$index_list = ParseIntputOptions($field_elements);
static $i=0;
while (list($item, $itemvalue) = each ($index_list))
{
list($item,$itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
if (strlen($itemvalue)==0) $itemvalue = $item;
$field_html .= '<input type="checkbox" value="'.htmlspecialchars($itemvalue).'" id="tv_'.$i.'" name="tv'.$field_name.'[]" '. (in_array($itemvalue,$field_value)?" checked='checked'":"").' /><label for="tv_'.$i.'">'.$item.'</label><br />';
$i++;
}
break;
// radio buttons (option)
case "option":
$index_list = ParseIntputOptions($field_elements);
while (list($item, $itemvalue) = each ($index_list))
{
list($item,$itemvalue) = (is_array($itemvalue)) ? $itemvalue : explode("==",$itemvalue);
if (strlen($itemvalue)==0) $itemvalue = $item;
$field_html .= '<input type="radio" value="'.htmlspecialchars($itemvalue).'" name="tv'.$field_name.'" '.($itemvalue==$field_value ?'checked="checked"':'').' />'.$item.'<br />';
}
break;
// image fields (image manager)
case "image":
case "file": // handles the input of file uploads
default: // the default handler -- for errors, mostly
$field_html .= '<input type="text" id="tv'.$field_name.'" name="tv'.$field_name.'" value="'.htmlspecialchars($field_value).'" />';
} // end switch statement
return $field_html;
?>