Topic on Extension talk:Semantic Forms Select/Flow

Selected options unexpexted label and value

2
Michele.Fella (talkcontribs)

Config: MW 1.32.0 + SMW 3.0.2 + SRF 3.0.1 + SF Select 3.0.0

1) It seems that latest SMW version have two different semantic search result types: List and Plain list.

You might want to use "format~Plain list" or the whole <span> tag will be considered as value.

2) In res/scriptSelect.js the SFSelect_processNameValues function is used for turning name values from 'Page (property)' results, eventually removing the brackets from the result value.

This function removes a number of leading/trailing characters from the result of the query.

I had no time to troubleshoot properly the code, but at least in my case the select options were wrongly updated no matther if the result of the query is a Page or a simple Text properties (probably missing checks and loop pointers not properly reset).

Assuming you are fine with "not post processing the result of the query" (this is my case) my quick and dirty workaround:




function SFSelect_processNameValues( values ) {
        var namevalues = [];
    for(var i=0; i<values.length; i++){
            // var openBr = 0;
            // var doneBr = 0;
            // var num = 0;
            var label = values[i];
            /*var labelArr = label.split("");
            var end = labelArr.length - 1;
            ... ...
            labelValue = ( labelArr.slice( startBr+1, endBr ) ).join("");
            labelKey = ( labelArr.slice( 0, startBr - 1 ) ).join("");
            */
            labelValue = label;
            labelKey = label;
            namevalues.push( [ labelKey, labelValue ] );
    }
    return namevalues;
}
Kghbln (talkcontribs)

Thanks for publishing your findings. Perhaps you would like to create a pull request at GitHub. @Toniher:

Reply to "Selected options unexpexted label and value"