O4WDialog (OpenInsight 64-bit)
At 23 SEP 2022 12:55:02PM BrianWick wrote:
Hi -
I have a section that is 900 pix wide but when I turn that section into an O4WDialog I no longer get the 900 pix span (wide) - but instead what appears to be a fixed 400 pix width.
Additionally O4WUpdate works within a Dialog Section
BUT
O4WGetValue does NOT work.
AND naturally when the section is NOT a dialog everything works.
Is there a way O4W can have a better Dialog() control that carries many more of the current features as you see in several other websites today.
Point being is Dialog sections can be made to bereally powerful well beyond the boiler plate O4WDialog
Bri
At 26 SEP 2022 03:04PM bshumsky wrote:
Hi, Brian.
Although it's odd, O4WDialog sizing can be controlled via the "addlOptions" parameter (parameter #5). You're expected to pass in these dialog options as name:value pairs (sorry, that's how the jQuery dialog expects them), so you can control the size by doing something like:
dialogParams = "width:900"
If you wanted to specify multiple parameters, you would separate them by a comma (",") - so something like this:
dialogParams = "width:900,height:300"
Regarding access values with O4WGetValue - yes, you can get the values back from the dialog box, but remember that O4W tries to figure out what fields go with what buttons and looks to YOU (in your program) to help it determine this, through the use of O4WMarkedOptions. So, you probably need to have the following in the section that defines the dialog box information:
O4WSectionStart("myDialogSection", O4WMarkedOptions(1))
The O4WMarkedOptions(1) tells O4W that this is a section that's got button(s) that "group" the fields in that section together. Thus, when the button is clicked, the values in the fields in that section are all sent back into OI.
Hope that helps,
- Bryan Shumsky
At 27 SEP 2022 10:21AM BrianWick wrote:
Tx Bryan -
I will check my snippet - but I think I already have all that -
albeit I use a BUTTON outside of the dialog section to open and close the dialog - which may explain what is happening.
bri
At 29 SEP 2022 10:53AM BrianWick wrote:
Hi Bryan -
Still no luck when using O4WGetValue on a control within an O4WDialog.
When I comment out O4WDialog (and the associated HIDE for that section) the O4WGetValue works perfect - because it is just a REGULAR section.
tx
Bri
* Subroutine O4W_DialogTest2(CtlEntId, Event, Request) $Insert O4WEquates $Insert POPUP_EQUATES * To Keep it simple "OPENDIALOG" and "CLOSEDIALOG" are to be clicked on ONLY ONCE If Event _eqc "CREATE" Then OuterSectionStyle1 = O4WMarkedOptions(1) ReplaceSectionStyle1 = O4WMarkedOptions(0) End Else OuterSectionStyle1 = O4WMarkedOptions(1):O4WResponseOptions() ReplaceSectionStyle1 = O4WMarkedOptions(0):O4WResponseOptions() End Begin Case Case Event _eqc "CREATE" O4WForm() GetDialogData1 = "Create" Gosub BuildSection Case CtlEntID _eqc "CLOSEDIALOG" * O4WGetValue for a control inside a dialog box does not work upon closing that dialog box * O4WResponse() GetDialogData1 = O4WGetValue("DIALOGDATA") * debug O4WSectionStart("GETDIALOGDATASECTION", ReplaceSectionStyle1) O4WTextBox(GetDialogData1,"", "GETDIALOGDATA", "GETDIALOGDATA", "") O4WSectionEnd("GETDIALOGDATASECTION") O4WDialog("DIALOGSECTION") Case CtlEntID _eqc "OPENDIALOG" O4WResponse() O4WDialog("DIALOGSECTION", "Key In Some Dialog Data", "","","","","") End Case Return BuildSection: O4WSectionStart("MAINSECTION", OuterSectionStyle1) O4WTableStart("MAINTABLE", O4WTableStyle("","","")) O4wSetCell(1,1) O4WSectionStart("OPENDIALOGSECTION", ReplaceSectionStyle1) O4WButton("Open Dialog", "OPENDIALOG") O4WQualifyEvent("OPENDIALOG","CLICK") O4WSectionEnd("OPENDIALOGSECTION") O4WSetCell(2,1) O4WSectionStart("GETDIALOGDATASECTION", ReplaceSectionStyle1) O4WTextBox(GetDialogData1,"", "GETDIALOGDATA", "GETDIALOGDATA", "") O4WSectionEnd("GETDIALOGDATASECTION") O4WSetCell(3,1) O4WSectionStart("DIALOGSECTION", O4WMarkedOptions(1)) O4WTableStart("DIALOGTABLE", O4WTableStyle("","","")) O4WSetCell(1,1) O4WSectionStart("DIALOGDATASECTION", ReplaceSectionStyle1) O4WTextBox(DialogData1,"", "DIALOGDATA", "DIALOGDATA", "") O4WSectionEnd("DIALOGDATASECTION") O4WSetCell(2,1) O4WSectionStart("CLOSEDIALOGSECTION", ReplaceSectionStyle1) O4WButton("Close Dialog", "CLOSEDIALOG") O4WQualifyEvent("CLOSEDIALOG", "CLICK") O4WSectionEnd("CLOSEDIALOGSECTION") O4WTableEnd("DIALOGTABLE") O4WSectionEnd("DIALOGSECTION") O4WQualifyEvent("","HIDE","DIALOGSECTION") O4WTableEnd("MAINTABLE") O4WSectionEnd("MAINSECTION") Return *
At 30 SEP 2022 04:28PM bshumsky wrote:
Hi, Brian. I'm looking into this, but I noticed something in your test code. You're not specifying the O4WTextBox correctly - you have this:
O4WTextBox(GetDialogData1,"", "GETDIALOGDATA", "GETDIALOGDATA", "" )
But the 3rd parameter is the optional "maximum input length". So you really need to have something like this instead:
O4WTextBox(GetDialogData1,"","", "GETDIALOGDATA", "GETDIALOGDATA", "" )
(notice the additional "" as the 3rd parameter) so the parameters are in the right place.
Also, I think you asked how you can make the little "x" (in the upper right, which can be used to close the dialog box) go away? If you specify the ID of a button that you're going to provide that will close the dialog box in parameter #6, value 2, then the "x" won't be drawn. So you can specify your O4WDialog call like this:
O4WDialog("DIALOGSECTION", "Key In Some Dialog Data", "","","",@vm:"CLOSEDIALOG" )
In fact, you can even name a "dummy" value there just to suppress the "x":
O4WDialog("DIALOGSECTION", "Key In Some Dialog Data", "","","",@vm:"DUMMYPARAM" )
Thanks,
- Bryan Shumsky
At 30 SEP 2022 06:57PM BrianWick wrote:
Hi Bryan -
I am able to remove the "x" - thanks for that help.
I was trying to get O4WGetValue to work with other controls like O4WTextArea where ultimately I did not call O4WTextBox correctly going back and forth.
Even everything is drawn correctly now - I still cannot get OW4GetValue to work.
AND -
As mentioned if i comment out both O4WDialog commands and the DIALOGSECTION HIDE command it becomes regular section and everything works.
tx
Bri
The corrected snippet is below:
Subroutine O4W_DialogTest2(CtlEntId, Event, Request) $Insert O4WEquates $Insert POPUP_EQUATES * To Keep it simple "OPENDIALOG" and "CLOSEDIALOG" are to be clicked on ONLY ONCE If Event _eqc "CREATE" Then OuterSectionStyle1 = O4WMarkedOptions(1) ReplaceSectionStyle1 = O4WMarkedOptions(0) End Else OuterSectionStyle1 = O4WMarkedOptions(1):O4WResponseOptions() ReplaceSectionStyle1 = O4WMarkedOptions(0):O4WResponseOptions() End Begin Case Case Event _eqc "CREATE" O4WForm() GetDialogData1 = "Create" Gosub BuildSection Case CtlEntID _eqc "CLOSEDIALOG" * O4WGetValue for a control inside a dialog box does not work upon closing that dialog box * O4WResponse() GetDialogData1 = O4WGetValue("DIALOGDATA") * debug O4WSectionStart("GETDIALOGDATASECTION", ReplaceSectionStyle1) O4WTextBox(GetDialogData1,"", "", "GETDIALOGDATA", "GETDIALOGDATA", "") O4WSectionEnd("GETDIALOGDATASECTION") O4WDialog("DIALOGSECTION") Case CtlEntID _eqc "OPENDIALOG" O4WResponse() O4WDialog("DIALOGSECTION", "Key In Some Dialog Data", "","","",@VM:"CLOSEDIALOG" ,"") End Case Return BuildSection: O4WSectionStart("MAINSECTION", OuterSectionStyle1) O4WTableStart("MAINTABLE", O4WTableStyle("","","")) O4wSetCell(1,1) O4WSectionStart("OPENDIALOGSECTION", ReplaceSectionStyle1) O4WButton("Open Dialog", "OPENDIALOG") O4WQualifyEvent("OPENDIALOG","CLICK") O4WSectionEnd("OPENDIALOGSECTION") O4WSetCell(2,1) O4WSectionStart("GETDIALOGDATASECTION", ReplaceSectionStyle1) O4WTextBox(GetDialogData1,"", "", "GETDIALOGDATA", "GETDIALOGDATA", "") O4WSectionEnd("GETDIALOGDATASECTION") O4WSetCell(3,1) O4WSectionStart("DIALOGSECTION", O4WMarkedOptions(1)) O4WTableStart("DIALOGTABLE", O4WTableStyle("","","")) O4WSetCell(1,1) O4WSectionStart("DIALOGDATASECTION", ReplaceSectionStyle1) O4WTextBox(DialogData1,"", "", "DIALOGDATA", "DIALOGDATA", "") O4WSectionEnd("DIALOGDATASECTION") O4WSetCell(2,1) O4WSectionStart("CLOSEDIALOGSECTION", ReplaceSectionStyle1) O4WButton("Close Dialog", "CLOSEDIALOG") O4WQualifyEvent("CLOSEDIALOG", "CLICK") O4WSectionEnd("CLOSEDIALOGSECTION") O4WTableEnd("DIALOGTABLE") O4WSectionEnd("DIALOGSECTION") O4WQualifyEvent("","HIDE","DIALOGSECTION") O4WTableEnd("MAINTABLE") O4WSectionEnd("MAINSECTION") Return *
At 01 OCT 2022 10:40AM bshumsky wrote:
Hi, Brian.
The actual fixes to the code are very minor, but the explanation is going to take a while…
Whenever you want a web page to return information to OpenInsight, the input controls (such as textboxes) and the button(s) that trigger the submission to OI, need to be "wrapped" together in a group. It's actually called a "form" in html, but I don't want to confuse us with that word, so I'll just call it a "group." These groups are contained within any sections that we define.
O4W tries to automatically build the grouping for you when you create your page, based on where your input controls are, and where your buttons are, but you can give it hints by using O4WMarkedOptions(1) or O4WMarkedOptions(0) on your sections. When you use O4WMarkedOptions(1), that's telling O4W you want a section to contain a group; if you use O4WMarkedOptions(0), you're telling O4W that you DO NOT want this section to contain a group.
Now, another thing about these groups - you can have more than one on an O4W page, but they can't "cross" or "nest." So you could have something like this:
Group1 starts
<input controls, buttons, etc.>
Group1 ends
Group2 starts
<input controls, buttons, etc.>
Group2 ends
But you CAN'T have something like this:
Group1 starts
<input controls, buttons, etc>
Group2 starts
<input controls, buttons, etc>
Group2 ends
Group1 ends
Or (even worse) this:
Group1 starts
<input controls, buttons, etc>
Group2 starts
<input controls, buttons, etc>
Group1 ends
Group2 ends
With me so far? The last bit of information you need to know is, when you create a dialog with O4WDialog, jQuery (our underlying library) "pulls out" that section into its own area of HTML, so that if you think of the HTML that you produced as something that starts at the top of the page and continues to the end of the page, the dialog is pulled out of that "flow" and treated separately.
OK, now we get to your program. If we take a look at how your sections are built, they look like this:
MAINSECTION starts OPENDIALOGSECTION starts <button here> OPENDIALOGSECTION ends GETDIALOGDATASECTION starts <textbox here> GETDIALOGDATASECTION ends DIALOGSECTION starts DIALOGDATASECTION starts <textbox here> DIALOGDATASECTION ends CLOSEDIALOGSECTION starts <button here> CLOSEDIALOGSECTION ends DIALOGSECTION ends MAINSECTION endsIn your BuildSection code, you had this at the start:
O4WSectionStart("MAINSECTION", OuterSectionStyle1)
where OuterSectionStyle1 is
OuterSectionStyle1 = O4WMarkedOptions(1)
So, you're asking O4W to make MAINSECTION a grouping. Because it contains input controls and buttons, O4W happily does this. You also have O4MarkedOptions(1) on the DIALOGSECTION section - but that's _inside_ the MAINSECTION, so it doesn't actually get a grouping.
Now, if you just ran this HTML straight from the top to the bottom, it works OK - because the overall grouping that's in MAINSECTION will "catch" all the buttons and input controls, and return them to OI. But if you ask O4WDialog to make DIALOGSECTION a dialog, it will "pull out" that section and its children - but there's no grouping in there! So when you hit the CLOSE DIALOG button, it can't find the textbox you're looking for.
To fix this, first and most importantly, you do NOT want to have the O4WMarkedOptions(1) on the MAINSECTION section, so it instead looks just like this:
O4WSectionStart("MAINSECTION" )
This allows O4W to determine where the grouping belongs by itself. That's enough to get the dialog to work properly.
Now, if you also want the textbox and button that you create in OPENDIALOGSECTION/GETDIALOGSECTION to work together, they should go in their own grouping - you can do this by either adding a new section AROUND those two sections, or you can change it so that OPENDIALOGSECTION encompasses GETDIALOGSECTION, and using O4WMarkedOptions there.
Let's illustrate the layout we want, showing where we use O4WMarkedOptions(1) with an "*" on the section name. You originally had:
*MAINSECTION starts OPENDIALOGSECTION starts <button here> OPENDIALOGSECTION ends GETDIALOGDATASECTION starts <textbox here> GETDIALOGDATASECTION ends *DIALOGSECTION starts DIALOGDATASECTION starts <textbox here> DIALOGDATASECTION ends CLOSEDIALOGSECTION starts <button here> CLOSEDIALOGSECTION ends DIALOGSECTION ends MAINSECTION endsBut as I said, that won't work, because MAINSECTION encloses DIALOGSECTION. So, the simplest fix is:
MAINSECTION starts OPENDIALOGSECTION starts <button here> OPENDIALOGSECTION ends GETDIALOGDATASECTION starts <textbox here> GETDIALOGDATASECTION ends *DIALOGSECTION starts DIALOGDATASECTION starts <textbox here> DIALOGDATASECTION ends CLOSEDIALOGSECTION starts <button here> CLOSEDIALOGSECTION ends DIALOGSECTION ends MAINSECTION endsNow DIALOGSECTION will have a grouping. But if you wanted to get the texbox info that's in GETDIALOGDATASECTION as well, then IT needs to be in a grouping too, so you could either have this:
MAINSECTION starts *OPENDIALOGSECTION starts <button here> GETDIALOGDATASECTION starts <textbox here> GETDIALOGDATASECTION ends OPENDIALOGSECTION ends *DIALOGSECTION starts DIALOGDATASECTION starts <textbox here> DIALOGDATASECTION ends CLOSEDIALOGSECTION starts <button here> CLOSEDIALOGSECTION ends DIALOGSECTION ends MAINSECTION ends(changing it so OPENDIALOGSECTION is "marked", and encloses GETDIALOGDATASECTION) or comparably this:
MAINSECTION starts *NEWSECTION starts OPENDIALOGSECTION starts <button here> OPENDIALOGSECTION ends GETDIALOGDATASECTION starts <textbox here> GETDIALOGDATASECTION ends NEWSECTION ends *DIALOGSECTION starts DIALOGDATASECTION starts <textbox here> DIALOGDATASECTION ends CLOSEDIALOGSECTION starts <button here> CLOSEDIALOGSECTION ends DIALOGSECTION ends MAINSECTION endsyou can add a new section ("NEWSECTION" ) around OPENDIALOGSECTION/GETDIALOGSECTION and use O4WMarkedOptions(1) on that new section.
I know it's a lot to take in, but hopefully this explains what you need to fix/change to get this to work properly for you.
- Bryan Shumsky
At 03 OCT 2022 07:04PM BrianWick wrote:
tx bryan -
For the very detailed explanation of marked sections for O4WDialog - UNDER the hood ….
All appears to work great now - VERY power stuff.
Tx
Bri