Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

The PTC Community email address has changed to Learn more.

File prompting element


File prompting element


We have an element in our schema, <file>, that has a single attribute, "href". We'd like to have the file prompter be invoked when this element is inserted so that the user does not have to enter a lengthy path. Of course, one way is to define <file> as a graphic element in the DCF file (not for print composition, however) and "href" as the "filename". This would probably work since you can specify "All files" and the Editor simply shows a broken graphic for nongraphic files.

But, is there a more elegant solution? It would be nice if the DCF file allowed you to define in general an element and attribute that simply invoked the file prompter. Note that we do not want the file content inserted or included. It just contains additional non-XML parameter information.

Any ideas?


Hi Dave--

This sounds like a job for the insert_tag_after doc callback. You could
put something like this in your instance.acl file:

# code written off the cuff, debugging left as an exercise

function getFileName(doc,tagname,op) {
if ((tagname == "file") && (op == 1)) {
# prompt user for filename
local fname = file_selector(".","xml","SGML Files|*.sgm|XML
if (fname != ") {


That should do what you are after. HTH.


While I don't know specifically about the "file prompter", you could always
use the <xuicontrol> directive in your dcf to replace the element with a
control you define in XUI that takes advantage of a java file browse prompt.
I will caution that we've ran into some problems with inline XUI in the
past, so have opted for simple ACL dialogs in order to set initial
attributes, but ours was mainly due to display when using a combobox. With
this approach, your file tag could have a FOSI directive to show
non-editable text, though I'm not sure how you'd re-trigger a browse dialog
when ctrl-d was pressed.

Depending on the number of <file> tags you are inserting, and your preferred
programming language, you can also use ActiveX controls, though I think
most/all of what you are trying to do could probably be handled with a XUI
button or similar.


This should be possible, provided we understand that "elegant" and
"easy" are not synonyms...

Use the insert_tag_callback(doc,element,op), and combine with the
file_selector() function. It should get you where you want to go.

One caveat: On the windows side of things, you'll want to use
universal_file_name(path) on the return from file_selector() to use UNC
filenames to keep mapped drive letters out of your markup. If you need
relative paths or URIs, you'll need to perform some other ACL fun to get
the desired return.

Hope this helps...


Thanks Clay! That works great.