The Menuselect input type is depending on the Semantic TreeView extension. Are there plans to further support this input type or will it be phased out? I guess a note about this should be on this extension's page. Cheers
Topic on Extension talk:Semantic Forms Inputs
Semantic TreeView is IMHO not maintainable. Instead I improved the tree format of Extension:SemanticResultFormats. Guess I should also update the menuselect documentation,
Yeah, that's why I asked. :) Cheers
Would absolutely love to see some syntax using the new tree format!
I changed the example.
I have got an other question abou menuselect: is it possible to select a value the type comma and selcet a second value? Becau in my case the first value is always been overwritten! Thanks for help.
Sorry, it is not possible to create a comma separated list with menuselect.
Thank you for the fast answer! What do you recommend instead? More multiselcet fields in a row mapping the same Property? Or maybe change the JavaScript of multiselect? If yes: where?
You could try some other input type, e.g. the twolistboxes input type available in the development version of the extension. You could of course also have several inputs or use a multiple template form. If you want to patch menuselect, have a look at the libs/menuselect.js file.
If I put more multiselctfields in a row for the same property the last textfield overwrites the others. So I will try to change the libs/menuselect.js file.
Ok, First sucess.
Line 219-227 was:
// clicked list item
.mousedown( function() {
var content = jQuery( this ).children( "table" ).find( ".cont" );
// set visible value and leave input
inputShow
.attr( "value", content.text() )
.blur();
I changed to:
// clicked list item
.mousedown( function() {
var content = jQuery( this ).children( "table" ).find( ".cont" );
if(inputShow.val())
{var mycontent=inputShow.val()+','+content.text();}
else
{var mycontent=content.text();}
// set visible value and leave input
inputShow
.attr( "value", mycontent)
.blur();
But after clicking "Save" the last value is taken! What do I do wrong? what's missing?
There is a difference between the displayed value and the value sent back to the server. With your change you only change the displayed value.
Try finding a line like jQuery( "#" + inputID ).attr( "value", content.text() );
and work on that.
Thank you for your help!
I made some changes from line 219-246.
Origin was:
// clicked list item
.mousedown( function() {
var content = jQuery( this ).children( "table" ).find( ".cont" );
// set visible value and leave input
inputShow
.attr( "value", content.text() )
.blur();
// set hidden value that gets sent back to the server
var link = content.children( "a" );
// if content is link
if ( link.length == 1 ) {
// use title set by MW
jQuery( "#" + inputID ).attr( "value", link.data( "title" ) );
} else {
// just use text of list item
jQuery( "#" + inputID ).attr( "value", content.text() );
}
return false;
} );
Now my code:
// clicked list item
.mousedown( function() {
var content = jQuery( this ).children( "table" ).find( ".cont" );
if(inputShow.val())
{var mycontent=inputShow.val()+','+content.text();}
else
{var mycontent=content.text();
}
// set visible value and leave input
inputShow
.attr( "value", mycontent)
.blur();
// set hidden value that gets sent back to the server
var link = content.children( "a" );
// if content is link
if ( link.length == 1 ) {
// use title set by MW
jQuery( "#" + inputID ).attr( "value", link.data( "title" ) );
} else {
// just use text of list item
jQuery( "#" + inputID ).attr( "value", inputShow.val() );
}
return false;
} );
It works ;-)
Just an other idea: Could it possible to define the behavier in the form with something like:
field|foo|input type=menuselect |structure=... |behavier=add/overwrite
But I'm not so much into php to change this.
I'll have to think about it. Could you raise an enhancement bug on https://bugzilla.wikimedia.org ?