How to add items to a dropdown list (selection list)

2013-01-06 Thread Angus Comber

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"


Re: How to add items to a dropdown list (selection list)

2013-01-06 Thread Misi Mladoniczky
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"


Re: How to add items to a dropdown list (selection list)

2013-01-07 Thread Sylvain YVON
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  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"
>

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


Re: How to add items to a dropdown list (selection list)

2013-01-08 Thread Jason Miller
Lol, I had not seen this thread yesterday when I pointed out your
JavaScript docs. Good timing.  With this and Laurent's additional findings
it looks like there  is some material for a part 3.

Jason
On Jan 7, 2013 7:25 AM, "Sylvain YVON"  wrote:

> **
> 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  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_

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


Re: How to add items to a dropdown list (selection list)

2013-01-26 Thread Angus Comber
Brilliant, I will give it a try.  It wasn't the most urgent thing so got 
dragged onto other things.  But will need to return to this shortly and if I 
get it working will post how I did it.

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


Rép : Re: How to add items to a dropdown list (selection list)

2013-01-07 Thread laurent matheo
**
Hi :)First message on ARSLIST ^_^ (wt)... 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  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-sideNow 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  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_


Rép : Re: How to add items to a dropdown list (selection list)

2013-01-07 Thread laurent matheo
**
Ok I can confirm that works, I used on a display form with three cascading lists, those values are from a php script linked to a mysql database:When you choose a tier 1, tier 2 and tier 3 are reloaded "live" accordingly:Here is the js code I used to build the menu, the goal is to have this (I used JQuery for this):new ARMenu(0,"_lma:test_charmenu",{novals:false,mval:[{l:"menu 1a",v:"val menu 1a"},{l:"menu2a",v:"val menu 2a"}]}); //Calling the php file that returns the json array.//json array is like this in case you want to test (don't bother the parameters operation, tier1, tier2)://{"saran_15::bananes_5::ananas_0":"saran_15::bananes_5::ananas_0","saran_15::bananes_5::ananas_1":"saran_15::bananes_5::ananas_1","saran_15::bananes_5::ananas_2":"saran_15::bananes_5::ananas_2","saran_15::bananes_5::ananas_3":"saran_15::bananes_5::ananas_3","saran_15::bananes_5::ananas_4":"saran_15::bananes_5::ananas_4"}	$.getJSON("http://192.168.0.14/testjson/testjson/get_tier.php",		{			operation: myOp,			tier1: myvalueT1,			tier2: myvalueT2		},		function(json){			var i=0;		var my_mval=new Array();			//traversing the json answer			$.each(json,function(key,value){//Creating the menumy_mval.push({l:key,v:value});i++;			});		//Creating the ARS menu now :)			new ARMenu(0,"_lma:test_charmenu",{novals:false,mval:my_mval});});With this you'll overwrite the data that were in the menu "_lma:test_charmenu".Le 07 jan 2013 à 21:52, "laurent matheo"  a écrit :Hi :)First message on ARSLIST ^_^ (wt)... 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  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-sideNow 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  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: "Wh