**
Hi :)

First message on ARSLIST ^_^ (woooot)... Time to grow up? I remember when I spoke about that with LJ at WWRUG12 that community was for kids and ARSLIST for grownups :)
But well... Kids like to hang with grown ups from time to time so bear with me ;)

So, as Sylvain told we worked a bit on this, "overwriting" a character menu with data coming from an external source (JSON for example), it seems that in 7.6.04 it's a bit different and it has an extra parameter.

The ARMenu object in ClientCore.js from 7.6.04 has this construction:
function ARMenu(windowID, menu_name, menu_data)

So you just need to add the "windowID" to the code Sylvain gave, it seems it's 0 by default, here what I did in an active link (run process):
_javascript_ new ARMenu(0,"_lma:test_charmenu",{novals:false,mval:[{l:"menu 1a",v:"val menu 1a"},{l:"menu2a",v:"val menu 2a"}]});

And it worked.

I tried the window.ARMenus part but it failed with a "window.ARMenus is undefined".
It seems ARMenus is a local variable used in the function "Form_Init".

Anyway, you can construct the "new ARMenu(0,"_lma:test_charmenu",{novals:false,mval:[{l:"menu 1a",v:"val menu 1a"},{l:"menu2a",v:"val menu 2a"}]});" part and run it to overwrite the menu.


Le 07 jan 2013 à 16:25, Sylvain YVON <sylvain.y...@gmail.com> a écrit :

**
Hi,

We were just looking into this with Laurent this morning for another requirement. The cleanest solution is clearly Misi's.
There just two drawbacks :
- you have to manage a table for your temporary records (=> delay, clustering, i/o ...) or use a "temporary table" if your DBMS allows it
- it implies a delay on the client-side

Now there is a client-side only solution with _javascript_ (yes, AGAIN :p). You need a dummy character menu, named "EmptyMenu" in my example. Attach it to your field.
The following code must be run from a Run Process action in an active link, and re-creates the dummy menu with the values you pass to the object constructor :
_javascript_ new ARMenu("EmptyMenu",{novals:false,mval:[{l:"val1",v:null},{l:"val2",v:null}]});







I can't test it right now, but this code _should_ work to add an item :
_javascript_ window.ARMenus["EmptyMenu"].mval.push({l:"label",v:"value"}); new ARMenu("EmptyMenu",window.ARMenus["EmptyMenu"]);




On Sun, Jan 6, 2013 at 12:30 PM, Misi Mladoniczky <m...@rrr.se> wrote:
Hi,

The drop-down-list must be created as a char-field with a search-menu
attached. You can set the display-attributes so that it looks like a
drop-down-list.

When you "Add" stuff, you must create records in a form, that will later
be displayed in your search-menu. Use the Push-Fields action to create
records.

        Best Regards - Misi, RRR AB, http://rrr.se

> I need to create the following:
>
> 1. A button named AddList with label Add to List.
>
> 2. A Character field called eg new_item.
>
> 3. A dropdown list initially empty (ie no dropdown items)
>
> The user enters text into the new_item field and clicks on AddList
> button to add the text item in new_item to the dropdown.
>
> I have scoured the docs and can't quite work it out.
>
> How would I do this?
>
> Angus
>
> _______________________________________________________________________________
> UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
> "Where the Answers Are, and have been for 20 years"
>

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
"Where the Answers Are, and have been for 20 years"

_ARSlist: "Where the Answers Are" and have been for 20 years_
_ARSlist: "Where the Answers Are" and have been for 20 years_

Reply via email to