Yeah, I've looked at how dropdown input is organized - it seems that you
first generate possible values making the list of <option> tags, and after
that mark the currently selected option with attribute ":selected". This
way, if I need totally dinamic behavior of an input, I have to patch the
php side too, because the current value is not available as javascript
variable.

-----
Yury Katkov


On Tue, Jul 29, 2014 at 11:15 PM, Yaron Koren <ya...@wikiworks.com> wrote:

> Hi Yury,
>
> How the current value is specifically set depends on which input it is...
> but the inputs themselves don't know anything other than the parameters
> that they're called with (which should be enough, of course).
>
> -Yaron
>
>
> On Tue, Jul 29, 2014 at 3:12 PM, Yury Katkov <katkov.ju...@gmail.com>
> wrote:
>
>> Hi!
>> This part I know. But I meant the javascript side - how the current value
>> is loaded there? Is there a method that allows me to retrieve the current
>> template field value whil I'm in js?
>>
>> -----
>> Yury Katkov
>>
>>
>> On Tue, Jul 29, 2014 at 5:49 PM, Yaron Koren <ya...@wikiworks.com> wrote:
>>
>>> Hi Yury,
>>>
>>> Well, each form input's own file (contained in /includes/forminputs)
>>> contains a getHTML() method, which in turn has a $cur_value parameter that
>>> holds the current value. All those getHTML() methods are called from
>>> SFFormPrinter::formHTML(), a monstrously large method that's really the
>>> heart of Semantic Forms. Look for the variables $cur_value and
>>> $cur_value_in_template in that function.
>>>
>>> -Yaron
>>>
>>>
>>> On Tue, Jul 29, 2014 at 10:39 AM, Yury Katkov <katkov.ju...@gmail.com>
>>> wrote:
>>>
>>>> > Yes, that kind of autocomplatetion might require some kind of custom
>>>> Javascript solutio
>>>> I'm trying to develop exactly that. For now I'm able to load the list
>>>> of <option > tags for all my dropdown, but I can't figure out, how to
>>>> initialize my dropdown with the current value. Yaron, what function
>>>> populates forms inputs with the current values (taken from templates)?
>>>>
>>>> -----
>>>> Yury Katkov
>>>>
>>>>
>>>> On Wed, Jul 23, 2014 at 12:44 AM, Yaron Koren <ya...@wikiworks.com>
>>>> wrote:
>>>>
>>>>> Hi Yury,
>>>>>
>>>>> Oh... that's a lot of files! Yes, that kind of autocomplatetion might
>>>>> require some kind of custom Javascript solution. Although, if the goal is
>>>>> to have a wiki page for each of those files, another option is to just
>>>>> create a page for each file automatically, with the first 2-4 of those
>>>>> template fields already filled in. You could do that with the Data 
>>>>> Transfer
>>>>> extension, or a custom script; the latter might be better, given the
>>>>> massive size of the data.
>>>>>
>>>>> -Yaron
>>>>>
>>>>>
>>>>> On Tue, Jul 22, 2014 at 12:43 PM, Yury Katkov <katkov.ju...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Yaron!
>>>>>>
>>>>>> > (First, it doesn't matter that much, but this question should
>>>>>> probably have been sent to the SMW users list.)
>>>>>> Sorry... I thought it requires the creation of form input or patching
>>>>>> the SF, so I asked it here.
>>>>>>
>>>>>> Thanks for the way, but it will not work for me because:
>>>>>>
>>>>>> 1) we will probably have 50-100 servers
>>>>>> 2) each of the servers will have lot's of files: sometimes several
>>>>>> terabytes of 10M images. That's a lot.
>>>>>> 3) I've used the example for the file server and it's my current
>>>>>> need/ However I'm very interested in a generic API calls from withing the
>>>>>> semantic form when we put some data in the form and sending the ajax call
>>>>>> to an api with our current field values as the parameters.
>>>>>>
>>>>>> for now I will try to solve this with javascript extension that
>>>>>> listens the blur() action and the REST-API that is responsible for
>>>>>> delivering the information
>>>>>>
>>>>>> -----
>>>>>> Yury Katkov
>>>>>>
>>>>>>
>>>>>> On Tue, Jul 22, 2014 at 4:09 PM, Yaron Koren <ya...@wikiworks.com>
>>>>>> wrote:
>>>>>>
>>>>>>> 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
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> WikiWorks · MediaWiki Consulting · http://wikiworks.com
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> WikiWorks · MediaWiki Consulting · http://wikiworks.com
>>>
>>
>>
>
>
> --
> WikiWorks · MediaWiki Consulting · http://wikiworks.com
>
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to