To demonstrate this, i've made a very simple, but useless, textbox widget for the demo and a program that just has a subfile with 3 records each containing a custom textbox widget. When enter is pressed, the values should be pulled from each of the textbox widgets and printed into the message box next to the subfile.
If I don't use a subfile, the value for the custom widget seems to update without any issue. However, with the subfile, there seems to be something that I am missing.
Custom widget js:
Code: Select all
function JMP_Textbox_Initialize(parms)
{
var id = parms.dom.id;
parms.dom.setAttribute("jmp_customtextbox","true");
var value = parms.evalProperty("value");
if (!value)
{
value = "";
}
parms.dom.innerHTML = '<input id="'+id+'_txt" type="text" value="'+value+'" style="width: 100%; height: 100%;">';
}
window.JMP_Textbox_OnSubmit = function(response)
{
var widgets = document.querySelectorAll("div[jmp_customtextbox]");
for( var i=0; i < widgets.length; i++)
{
var idVar = widgets[i].pui.formatName+ "." + widgets[i].pui.fieldName;
var element = document.getElementById(widgets[i].id + '_txt');
if (element)
{
var value = element.value;
if (value == null)
{
value = "";
}
response[idVar] = value;
}
}
return true;
}
// Add the base widget
pui.widgets.add(
{
name: "custom textbox",
newId: "Customtextbox",
menuName: "Custom textbox",
defaults:
{
"width": "250px",
"height": "25px",
},
propertySetters:
{
"field type": function(parms)
{
JMP_Textbox_Initialize(parms);
},
"value": function(parms)
{
JMP_Textbox_Initialize(parms);
},
}
});
pui.toolbox.add(
{
category: "Custom Widgets",
widget: "custom textbox",
text: "Custom textbox",
icon: "/profoundui/proddata/images/icons/google_maps.png",
proxyHeight: 25,
proxyWidth: 250,
proxyHTML: '<input type="text" value="Custom Textbox" style="width: 100%; height: 100%;">',
defaults:
{
}
});
Code: Select all
A R ZT1002 SFL
A QPUI000001 1A O 2 2
A @TEST 10A H
A R QSFLCTL001 SFLCTL(ZT1002)
A SFLSIZ(0001)
A SFLPAG(0001)
A SFLDSP
A 1 2HTML('QPUISFLZT1001')
A R ZT1001
A 31 32 30 CA01
A 1 2HTML('QPUICTL1 ZT1002 5 RS-
A FLDSP 0 E1 3 N30RSFLDSP-
A CTL 0 E1 3 N31RSFLCLR 0-
A E1 3 31RSFLPAG 1 C-
A 1 5 RSFLSIZ 1 C4 9999 0-
A 0 ')
A 1 2HTML('{"screen":{"record format nam-
A e":"ZT1001","description":"Main Rec-
A Format","document title":"Title","-
A onsubmit":"JMP_Textbox_OnSubmit;"},-
A "items":[{"id":"Exit","field type":-
A "button","css class":"button","valu-
A e":"Exit","left":"770px","top":"400-
A px","width":"255px","shortcut key":-
A "F3","height":"65px"},{"id":"TextAr-
A ea1","field type":"text area","valu-
A e":{"fieldName":"MYMSG","dataLength-
A ":"2000","trimLeading":"false","tri-
A mTrailing":"true","blankFill":"fals-
A e","rjZeroFill":"false","dataType":-
A "char","formatting":"Text","textTra-
A nsform":"none","designValue":"[MYMS-
A G]"},"left":"770px","top":"180px","-
A height":"210px","width":"250px","vi-
A sibility":"visible"},{"id":"Menu1",-
A "field type":"menu","color":"#66000-
A 0","font family":"Arial","font size-
A ":"14px","font weight":"bold","hove-
A r background color":"#ffffff","hove-
A r text color":"#FFFFFF","animate":"-
A false","border color":"#EEEEEE","me-
A nu option indent":"9px","option hov-
A er image":"/profoundui/proddata/ima-
A ges/menus/harvest/menu_image4.png",-
A "background color":"#ffffff","left"-
A :"1190px","top":"330px","height":"6-
A 0px","width":"120px","visibility":"-
A hidden","onoptionclick":"var rowCli-
A cked = this.pui.properties[\"user d-
A efined data\"];\npui.set(\"TextBox2-
A \" + \".\" + rowClicked, value);\np-
A ui.click();\n"},{"id":"Grid1","fiel-
A d type":"grid","css class":"bluepri-
A nt-grid","left":"210px","top":"180p-
A x","border color":"transparent","co-
A lumn headings":"Header 1,Header 2,H-
A eader 3","column widths":"530","css-
A class 2":"blueprint-defaults","hea-
A der height":"38","height":"288px","-
A number of columns":"1","number of r-
A ows":"6","row height":"50","visibil-
A ity":"visible","width":"531px","dis-
A play subfile":{"fieldName":"N30","c-
A ustomTrue":"","customFalse":"","dat-
A aType":"expression","formatting":"I-
A ndicator","indFormat":"true / false-
A "},"display control record":{"field-
A Name":"N31","customTrue":"","custom-
A False":"","dataType":"expression","-
A formatting":"Indicator","indFormat"-
A :"true / false"},"clear subfile":{"-
A fieldName":"31","customTrue":"","cu-
A stomFalse":"","dataType":"expressio-
A n","formatting":"Indicator","indFor-
A mat":"true / false"},"subfile size"-
A :"9999","subfile record number":{"f-
A ieldName":"@rrn","dataLength":"5","-
A decPos":"0","numSep":"false","zeroB-
A alance":"false","numBlankFill":"fal-
A se","zeroFill":"false","noExtraSpac-
A es":"false","curSym":"","dataType":-
A "zoned","formatting":"Number","negN-
A um":"-999.00","units":""},"subfile -
A end":{"fieldName":"32","customTrue"-
A :"","customFalse":"","dataType":"ex-
A pression","formatting":"Indicator",-
A "indFormat":"true / false"},"record-
A format name":"ZT1002')
A 1 2HTML('","description":"Subfile"},{"-
A id":"Customtextbox1","field type":"-
A custom textbox","value":{"fieldName-
A ":"@test","dataLength":"10","trimLe-
A ading":"false","trimTrailing":"true-
A ","blankFill":"false","rjZeroFill":-
A "false","dataType":"char","formatti-
A ng":"Text","textTransform":"none","-
A designValue":"[@test]"},"left":"5px-
A ","top":"5px","width":"465px","heig-
A ht":"30px","grid":"Grid1","column":-
A "0"}]}')
A @RRN 5S 0H
A MYMSG 2000A H
Code: Select all
HDATFMT(*iso)
HTIMFMT(*HMS)
H DFTACTGRP(*NO)
/DEFINE PROFOUNDUI
h option(*nodebugio:*srcstmt:*noexpdds)
H**********************************************************
H* Version..: 1.00
H* Author...: Jacob Preston
H* Date.....: 06/10/2019
H*
H* Description:
H* Widget Development Test Program
f**********************************************************
fZT100S cf e workstn HANDLER('PROFOUNDUI(HANDLER)')
f sfile(ZT1002:@rrn)
f extfile('ZT100S')
f infds(info)
d**********************************************************
d*Variable Declarations
d i s 4 0 inz
d reccount s 4 0 inz
d*Constant Declarations
d crlf C CONST(X'0d25')
d*Exit Hotkey F3
dexit c const(X'33')
d*Enter Hotkey Enter
denter c const(X'F1')
d
dinfo ds
d screenrec *record
d cfkey 369 369
d pgmsts sds
d pgmnam *proc
d userid 358 367A
d MsgTxt 91 170A
c**********************************************************
/FREE
exsr Main;
*inlr=*on;
/////////////////////////////////////////////////////////////////////////////////////////////
//LoadSFL - Load subfile
/////////////////////////////////////////////////////////////////////////////////////////////
begsr LoadSFL;
@rrn=0;
*in31 = *on; //Clear subfile
write ZT1001; //Write to screen record holding subfile
*in30 = *off; //Display subfile
*in31 = *off; //Display Control Record
@test='Option 1';
@rrn += 1;
write ZT1002;
@test='Option 2';
@rrn += 1;
write ZT1002;
@test='Option 3';
@rrn += 1;
write ZT1002;
reccount = @rrn; //Store record count for iterating through/chaining/printing values later
*in32 = *on; //End of File
endsr;
/////////////////////////////////////////////////////////////////////////////////////////////
//Main - main control loop
/////////////////////////////////////////////////////////////////////////////////////////////
begsr Main;
exsr LoadSFL;
DOW *inlr=*off;
exfmt ZT1001;
select;
when cfkey=exit;
leave;
when cfkey=enter;
for i = 1 to reccount;
chain(e) i ZT1002;
if not %error;
mymsg = %trim(mymsg) + crlf + @TEST;
endif;
endfor;
endsl;
enddo;
endsr;
/END-FREE