Hi, could you help me? In a (protected) page I have two fields side by side, (“Fornitore”):
<td colspan="4" class=" ">
<input type="text" name="cdFornitore" value="" maxlength="10" onchange="getFornitoreInve();">
<input type="text" name="nome" value="" maxlength="160" style="width:65%">
<span id="hForn">
<a title="" class="button input-help grid-1" draggable="false" href="javascript:;" onclick="Next.submit(FormDet,'/sebina/catalogazione/D_INV_NUO_COLL.do?operation=helpFornitore');return false;" data-padlock="false">
<span>
Help</span>
</a>
</span>
<input type="hidden" name="idForn" value="">
</td>
I’m trying with a userscript to set the value “example” in the left side of “Fornitore” field, if empty. Normally I fill in the field on the left, press enter key (or click on the field on the right) and the software automatically reproduces a standard text in the field on the right. This script I tested populates the left field correctly, but the right field remains empty:
setTimeout(function() {
setme = document.getElementsByName("cdSupplier")[0];
if (setme.value === "") {setme.value="example"};
},100);
I also tried to reproduce the click in the right field, but nothing changes and the right field isn’t filled up.
setme = document.getElementsByName("cdSupplier")[0];
clickme = document.getElementsByName("name")[0];
if (setme.value === "") {
setme.value="example";
clickme.click();
}
Thank you!