The same problem. &aliastype=`%id%` or &aliastype=`%Y%.%m%.%d%` works correctly. But &aliastype=`%id%.%Y%.%m%.%d%` does not work, disappears id. Why?
Terry, i think have the solution for you. Bruno did this little snippet and i just hacked it a bit to use it multiple time in my FDM form:
<?php
/*
==================================================
GetInputByTv
==================================================
Renders a TV input as in Manager to the frontend
Author: Bruno Perner [email protected]
Version:
--------------------------------------------------
*/
//global $modx; // i dont need this
$idname=(isset($idname)) ? $idname:"";
$fields= "*";
$docid= (isset($docid)) ? $docid :"";
$published= 1;
$tv = $modx->getTemplateVar($idname, $fields, $docid, $published);
require_once ('tmplvars.inc.php'); // require_once is required if you need to call the snippet multiple time in the form.
$output=renderFormElement($tv['type'], $tv['name'], $tv['default_text'], $tv['elements'], $tv['value'], $tv['style']);
return $output;
?>
use it like that :
[[GetInputByTv? &idname=`YourTVName` &docid=`[+id+]`]]
hope it help.
CTRL+SHIFT+U - Clear Cache
CTRL+SHIFT+H - Hiding Heft Panel
CTRL+SHIFT+N - Fast Create Resource
CTRL+ALT+P - Preview Recource (in edit resorce window)
CTRL+ALT+S - Save
Manu
Thank you. This looks like it could be useful in a variety of situations. Although, I’m not sure how this is supposed to work with FDM.
I created a new TV (droplist) with three possible values and added it to the FDM model document.
I added the GetInputByTv call to the FDM model document.
When I create a new document using FDM, the TV specified by GetInputByTv doesn’t appear on the page for me to select a value. If I complete the form and view the newly created document, the TV now appears on the page as a droplist with three choices. Of course it doesn’t do anything at this point.
So I’m not sure how this helps me? I think I’m missing something.
I had thought I need only change the &eform_tpl called by FDM to use a different field type (checkbox instead of text). The check box appears on the page just fine, but the TV isn’t populated when the FDM document is submitted.
The type=text works just fine, but I want to have the user select pre-defined values to populate the TV.
www.terrybarthdesign.com
Quote from: Terry at Mar 23, 2009, 05:07 PM
I added the GetInputByTv call to the FDM model document.
No ! you must add the snippet call
in the FDM eform tpl not in the model.
in your model you must have the tv associated that’s right.
here’s how i use this snippet in my FDM to add a select input where you can choose a color for a tv :
there is my FDM call : [!FDM? &canmoderate=`test` &tplLinks=`iconesRF` &redirect=`174` &id=`[*id*]` &model=`21` &parent=`174` &disableedit=`1` &disablepublish=`1` &disableunpublish=`1` &disabledelete=`1`
&eform_tpl=`fdmEformTable`!]
..&eform_tpl=`fdmEformTable`... code is :
....
<td>
<!-- date -->
<label for="longtitle">Intervention:</label>
<input name="longtitle" id="longtitle" value="[+longtitle+]" type="text" />
[[GetInputByTv? &idname=`longtitleColor` &docid=`[+id+]`]]
</td>
....
my tv name is "longtitleColor" and is set to "dropDownList" (but you can use want you want it work the same..) and the optionals values are "||rouge==rouge||bleu==bleu||vert==vert".
the final output is :
<select onchange="documentDirty=true;" size="1" name="tvlongtitleColor" id="tvlongtitleColor"><option value=""/><option value="rouge">rouge</option><option value="bleu">bleu</option><option value="vert">vert</option></select>
CTRL+SHIFT+U - Clear Cache
CTRL+SHIFT+H - Hiding Heft Panel
CTRL+SHIFT+N - Fast Create Resource
CTRL+ALT+P - Preview Recource (in edit resorce window)
CTRL+ALT+S - Save
i had the same white page with the original snippet found here :
http://www.modxcms.de/forum/comments.php?DiscussionID=1001#Item_2 and because i use the original snippet twice in my form.
CTRL+SHIFT+U - Clear Cache
CTRL+SHIFT+H - Hiding Heft Panel
CTRL+SHIFT+N - Fast Create Resource
CTRL+ALT+P - Preview Recource (in edit resorce window)
CTRL+ALT+S - Save