PC SOFT

GRUPOS DE DISCUSSÃO PROFISSIONAL
WINDEVWEBDEV e WINDEV Mobile

Inicio → WEBDEV 2024 → Using a Form as a Popup Window
Using a Form as a Popup Window
Iniciado por Antonio Díaz, dez., 31 2020 2:11 AM - 12 respostas
Membro registado
70 mensagems
Popularité : +2 (2 votes)
Publicado em dezembro, 31 2020 - 2:11 AM
Hello,

Since I am only starting to use Webdev (or any PC Soft solutrion for that matter), what would seem easy becomes hard. In this case I am using a Looper control to display the contents of a Data File and want to update a certain row in another window. Since I am trying to use one single window for my app, I am using the Planes and the Popup windows.

What I want to achieve is for the Form (to update a record) to be part of a popup window. So far I haven't been successful because the popup window always display the first record of the Looper. I remember when using a different window, I would send the unique identifier as a parameter to the form window to make sure it would locate the right record. However, as far as I know the popup window is part of the same (calling) window, so how can I go about this?

Thank you in advance for your help!

--

Antonio Diaz
Emphasys Software, S.C.
Membro registado
32 mensagems
Popularité : +1 (1 vote)
Publicado em dezembro, 31 2020 - 11:38 AM
Hi Antonio

Use the ATT_ property in the looper rather than the file variable itself. If you look in the description of the Looper, at the top of the general tab, the are a list of attributes linked to the controls. Use them as the identifier the retrieve the record using that.

Hope this helps
Membro registado
70 mensagems
Popularité : +2 (2 votes)
Publicado em dezembro, 31 2020 - 6:45 PM
Thanks Simon.... it didn't work.... the popup page always retrieves the same (first) record... Still trying to find the problem...
Publicado em janeiro, 02 2021 - 2:54 PM
Hello,

I feel for you and this is where Windev, WEB, and mobile suffers from strength, this is just my opinion.

I dont know what type of mechanism you are using to call your Popup form, however I will try the following:

Lets look at some scenarios here

Your looper is linked to the database itself (Not to a query)
Lets say your table is Customers
So, you are viewing Record Number 20 in your looper as for this example Customer Number "6556446"

I will construct a Query, either by code or physically in your project name "Qry_Get_Customer" with a parameter named pCustomer_Number (The "p" is so that you identify your Parameter when typing your code)

attach the Lopper or the Table of the PopUp to this query then

Create a Button to call the Popup and on the Click (Ajax) Event ON YOUR FORM Not on the Popup.

Qry_Get_Customer.pCustomer_Number = Your_Table_Name.Col_Customer_Number) OR Your_Looper_Name.ATT_Customer_Number) This will pass the Record selected number into the pCustomer_Number Parameter
HExecuteQuery(Qry_Get_Customer)
HReadFirst()

TableDisplay(Your Table Name Here) OR

LooperDisplay(Your Looper Name Here)

Now you Open your Popup, AND that Record should be displayed there.



Now, scenario 2 is attaching the same table FILE (CUSTOMERS) NO QUERY to both, the form and the popup to both the form and the popup.

You do a
HReadSeekFirst(CUSTOMERS, CUSTOMER_ID, YOUR TABLE NAME.COL_CUSTOMER_ID)

THEN here you DO a TableSelectPlus FUNCTION like this

TableSelectPlus(YOUR POPUP TABLE NAME HERE, TableSelect(YOUR FORM TABLE OR LOOPER NAME HERE NAME HERE)


And Open your Popup.

I hope this helps

Best regards,
Carlos
Membro registado
32 mensagems
Popularité : +1 (1 vote)
Publicado em janeiro, 04 2021 - 11:45 AM
Hi Antonio

What Carlos has said should work. If you still have a problem, then check that the control that is linked to reference to the file in the looper is an edit control set to Numeric and not a static control. I had a similar problem yesterday. I was using a static control and it was returning "5" not 5. So whichever looper I clicked on, it always selected the first to display. Changed it to an edit control and it worked perfectly.

Hope this helps

--
Simon Phillips
OtterReg Software
Membro registado
70 mensagems
Popularité : +2 (2 votes)
Publicado em janeiro, 08 2021 - 8:21 PM
Hi Carlos,

I've read your post several times, first of all, I really appreciate it. Second, I've been using Webdev for a few weeks now and still consider myself a beginner so I would like to ask you what do you mean by Form and Popup. The way I see it, the Form is the Popup window that will be displayed for the user to edit the values of the record but when you write:

<<Create a Button to call the Popup and on the Click (Ajax) Event ON YOUR FORM Not on the Popup. >>

I get confused.

Third, I think I might be misunderstanding but, am I supposed to use the looper to display only one record? (the one I want to edit) and then call the popup?.... I believe I am still not sure if you meant that, sorry for my inexperience.

--

Antonio Diaz
Emphasys Software, S.C.
Publicado em janeiro, 12 2021 - 5:53 AM
Hi Antonio sorry for responding so late.

My apologies,

It should be Page instead of Form.

and for the next question, is No, you can use the looper to see all the records but you need to use

TableSelectPlus(Your Popup Table Name here, TableSelect(MyTable_fromThe_Page_Name_Here)

Let me explain the TableSelectPlus what it is like a find command.

In order for the TableSelectPlus to work needs to have a value for example 20.

Where you get this value and assign it to the TableSelectPlus? from your Page Table.

When you click with your mouse on a record in your Page's Table, automatically that has an invisible Record number, which PCSoft calls it subscript (Which I Hate with Passion). This invisible number we can get it by

saying TableSelect(YourTable Name) for example TableSelect(Table_Customers)

So if you click on the 3rd row of records in your Table_Customers

and put this code on a button Ajax-enabled,

Info(TableSelect(Table_Customers)) //You are going to get a message with the Number 3 on it


See? Now when you open your popup you say

TableSelectPlus(Your Popup Looper name here, TableSelect(page_customer.Table_Customers))


The cursor should land on the 3rd row of the Looper, then you do a file to page then you edit or whatever.

I miss my Delphi programming. Delphi was and still is the king in this matter, but not as good as Webdev doing Web

Let me know if you got it working.

Regards,

Carlos
Membro registado
70 mensagems
Popularité : +2 (2 votes)
Publicado em janeiro, 25 2021 - 7:50 PM
Hi Carlos,

Thank you so much! It is working now.... I really feel like I have a long way to go because there's so much I want to do but I don't know how, so... baby steps...

Thanks again,

--

Antonio Diaz
Emphasys Software, S.C.
Publicado em janeiro, 25 2021 - 10:42 PM
Hi Anthonio,

I am glad that is working now.
Yes, pure baby steps.

Data access and editing are some of the downsides of this tool. If not, this tool would be the number one.

Is kind of weird the way they designed this part. If you forget for example a PagetoFile or a FiletoPage, Oh Lord!! you could be spending hours scratching your head until you realized that it was missing.

But for now, this is what we got.

look if you get stuck in something again, and if I can help you out, remember I do not know all, Post in the forum first and then drop me an email carlos.antunez@canissoft.com

Take care
Carlos
Membro registado
70 mensagems
Popularité : +2 (2 votes)
Publicado em janeiro, 26 2021 - 5:10 PM
Thanks Carlos, I will certainly do that, I really appreciate your help!

--

Antonio Diaz
Emphasys Software, S.C.
Publicado em junho, 16 2022 - 6:45 AM
Popup windows are widely used in modern web design. Some popups contain links to important contact information. Sometimes they reveal an email form. When a visitor opens the popup window, they are able to leave contact information or send an email.
Membro registado
8 mensagems
Publicado em julho, 15 2022 - 1:57 PM
This tutorial includes no mention of accessibility, and because it doesn't trap focus, can actually result in a bad user experience.

I recommend looking over the W3 modal tutorial and incorporating some of the points about focus trapping and accessibility into this one

https://www.w3.org/TR/wai-aria-practices-1.1/examples/dialog-modal/dialog.html
https://omegle.club / https://shagle.download
Membro registado
8 mensagems
Publicado em julho, 25 2022 - 12:36 PM
The Dialog is triggered with a click on the button (#create-user)

$( "#create-user" ).button().on( "click", function() {
dialog.dialog( "open" );
});
You can put your html form into the #dialog-form div on the page (take a look at the other examples at jQuery-UI) The dialog itself will be initialised with this snippet:

dialog = $( "#dialog-form" ).dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Create an account": addUser,
Cancel: function() {
dialog.dialog( "close" );
}
},
close: function() {
form[ 0 ].reset();
allFields.removeClass( "ui-state-error" );
}
});
Note: To use the script you have to embed the jQuery-UI-Library. There are some js/css only popup windows but I prefer the jQuery-solution.