Hi Yury,

(First, it doesn't matter that much, but this question should probably have
been sent to the SMW users list.)

You didn't explicitly say it, but I'm guessing that (a) the set of file
names to be autocompleted on is all the files contained in that file
server, and (b) this information is not stored anywhere in the wiki.

Assuming that, I think there's a way to do this, but it takes some work,
and it's a hack. First, you'd need to write some web-based script, outside
of the wiki, that, when you go to the URL for that script, outputs a table
with two columns: a server name and a file name; containing the entire list
of all the relevant files and of course the server for each. It can be done
as CSV, XML or JSON, though I would think the easiest way to do it would be
as CSV.

Then you should install the External Data extension, if you don't have it
already, and, in one page in the wiki (it can be any page), have a call to
#get_web_data and then #store_external_table, so that all of that data gets
stored as subobjects. It's important that the #store_external_table call
uses the same semantic properties that are used in the template. So if your
template has properties like "Has server" and "Has filename", the
#store_external_table call should look something like:

{{#store_external_table:Server-file pair |Has server={{{server}}} |Has
filename={{{file}}} }}

(The property name in the first argument doesn't matter.)

Now, within the form, you just need to use "values dependent on" within the
"Filename" field. Let's say that the template is called "File information",
and the first two template fields are "Server" and "Filename". The
"Filename" field tag in the form might look like:

{{{field|Filename|input type=text with autocomplete|values dependent
on=File information[Server]}}}

...and hopefully that will work. Who knows, stranger things have happened.
:)

What makes this more of a hack is that the wiki page with the
#store_external_table call will need to have its data regularly refreshed
in order to capture any changes to the set of files. That can be done by
resaving the page, or calling an SMW data refresh in some way.

-Yaron


On Tue, Jul 22, 2014 at 5:45 AM, Yury Katkov <katkov.ju...@gmail.com> wrote:

> Hi Yaron, everyone!
>
> Very often I need to perform some actions while being inside the form. For
> example right now I have this form:
> http://i.imgur.com/cYNHSFN.png
>
> I need the following behavior:
> 1) User picks the file server from the dropdown
> 2) The form sends the js-query to the server and retrieves the filenames.
> 3) the Filename field got populated with autocompletion values - possible
> filenames.
>
> How do you think is possible to achieve such behavior?
> -----
> Yury Katkov
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Semediawiki-devel mailing list
> Semediawiki-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
>
>


-- 
WikiWorks · MediaWiki Consulting · http://wikiworks.com
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to