You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Michiel, the new functionality to select from available IDs for IDREF type attributes will be extremely useful for us. The current implementation resets all selections when a new ID is added to the form. Here is the solution I had implemented before your update (which may, or may not be useful to you). It appends a 'select' next to the input field temporarily when the user clicks on the field, which in turn populates the input field with the user selection. The layout is not pretty, but the concept works. Thanks.
document.addEventListener('DOMContentLoaded',function(){addOnClicksToCrossRefs();},false);functionaddOnClicksToCrossRefs(){// get all the cross ref attributes varxpathExpression='//input[@data-xsd2html2xml-primitive="idref"]';varxpathResult=document.evaluate(xpathExpression,document,null,XPathResult.ANY_TYPE,null);crossrefs=[];while(node=xpathResult.iterateNext()){console.log('cross ref : '+node);crossrefs.push(node);}// add "onclick" to the cross reference fieldscrossrefs.forEach(addOnClicks);functionaddOnClicks(value){value.setAttribute('onclick','getIDs(this);')}}functiongetIDs(crossref){// remove old dropdownif(crossref.nextElementSibling.tagName=="SELECT"){crossref.nextElementSibling.remove();}// get all the UniqueIDsvarxpathExpression='//input[@data-xsd2html2xml-primitive="id"]';varxpathResult=document.evaluate(xpathExpression,document,null,XPathResult.ANY_TYPE,null);varoptions=[];while(node=xpathResult.iterateNext()){if(node.value!=""){elementName=node.parentElement.parentElement.getAttribute("data-xsd2html2xml-name");attributeName=node.parentElement.getAttribute("data-xsd2html2xml-name");idvalue=node.value;options.push([elementName,attributeName,idvalue]);}}// append drop down menuvardropdown=document.createElement("select");dropdown.onchange=function(){crossref.value=dropdown.options[dropdown.selectedIndex].value;if(crossref.nextElementSibling.tagName=="SELECT"){crossref.nextElementSibling.remove();}}crossref.parentNode.insertBefore(dropdown,crossref.nextSibling);options.forEach(addToSelect)dropdown.innerHTML+='<option disabled selected value> -- select an option -- </option>';functionaddToSelect(value){dropdown.innerHTML+='<option value="'+value[2]+'">'+value[0]+" "+value[1]+" "+value[2]+'</option>';}}
The text was updated successfully, but these errors were encountered:
Hi Michiel, the new functionality to select from available IDs for IDREF type attributes will be extremely useful for us. The current implementation resets all selections when a new ID is added to the form. Here is the solution I had implemented before your update (which may, or may not be useful to you). It appends a 'select' next to the input field temporarily when the user clicks on the field, which in turn populates the input field with the user selection. The layout is not pretty, but the concept works. Thanks.
The text was updated successfully, but these errors were encountered: