PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 2024 → Accessing user-interacted data in server code in AWP
Accessing user-interacted data in server code in AWP
Débuté par Aybars Moralı, 05 mar. 2008 10:22 - 4 réponses
Posté le 05 mars 2008 - 10:22
Hi,

I started my WebDev application in standart dynamic mode. But then I decided to convert it to AWP mode, and I did. But there are some problems:

-First one is strange. There is a combobox, it displays different cells according to the choice, it is done with pagedisplay and parameters. When the related cell comes, the comboboxes inside are already filled in server code and their stored values are added too. User enters data to edit controls, selects data via comboboxes and clicks the button, then in the buttons server code it is expected to add the record to database in AJAX mode. The problem starts here, I cannot access to comboboxes' displayed value and stored value. I put Info() everywhere and saw that combobox is empty. Err, in fact not empty, it just has the element "Please select a product" which is inserted somewhere before the AJAX call. So, I solved this problem with the famous hidden control technique but I am not sure if it is a nice solution. I have a hidden combobox, in AJAX call I filled it with the ex ones stored value and in browser code of combobox I wrote HiddenComboBox[ListSelect(RealVisibleComboBox
)] value to a hidden edit control. As a result I used a few hidden controls, I didn't fetch more data from database. But the page looks dirty in the development phase :)

-Second one is not complicated :) In the same page, in the other cell I have a table. It is filled in the initialization code of the page and first column is a check box and it is editable. Other columns are text and non-editable. User selects desired items via checkbox and clicks the button. Same as above, in AJAX mode it is expected to be added. In server code I can access all data except the checkboxes. They all seem to be false (default value). Here probably I can use a hidden edit control and pass checkbox data via it but I wonder if it is the perfect solution or not.

All these codes were working in standart dynamic mode. And when I debug it, I convert to standart dynamic mode and it works. But when I convert it to AWP the problem occurs.

Bonus question: The hidden fields can be seen by the users, right? Can users change the value of the hidden fields?
Posté le 05 mars 2008 - 12:19
Hi again,

Ok, I admit, it is a hard question, I am simplifying it.

In an AWP dynamic page,
-I cannot access the information in server code that I have gathered it before with an AJAX call.
-I cannot know if a checkbox column of a table is selected or not in server code or in browser code.
Posté le 05 mars 2008 - 13:01
Hi...

If I undertsnad correctly your question, I'm a little afraid when you
are talking about server code like that...

It seems that you are using AJAX, which means that you are in BROWSER
code, calling a server procédure. This server procedure knows ONLY what
you are sending it via it's parameters. The content of the page fields
are NOT send to the server (look at your button settings) and therefore
the only thing that the server knows about them is their status AT THE
TIME OF THE PAGE OPENING/INIT...

So you have to gather information on the browser side, send it as
parameters of your server proc, and then rely on that an on that only...

Or you have to forget ajax and let the normal submit button send the
whole thing to the server...

AWP has nothing to do with the problem IMHO...

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

More information on http://www.fabriceharari.com


Aybars Moralı wrote:
Hi again,

Ok, I admit, it is a hard question, I am simplifying it.

In an AWP dynamic page,
-I cannot access the information in server code that I have gathered it before with an AJAX call.
-I cannot know if a checkbox column of a table is selected or not in server code or in browser code.
Posté le 05 mars 2008 - 14:51
Thanks for the explanation Fabrice. But I tried to ask something different. After my combobox filled, after a submit I cannot access the combobox information.

I tested some and here is a simple case:
In an AWP page there is one combobox and one button.

Click of BTN_Button1 (server)
ListDeleteAll(COMBO_ComboBox1)
ListAdd(COMBO_ComboBox1, "1" + gLink("11"))
ListAdd(COMBO_ComboBox1, "2" + gLink("22"))
ListAdd(COMBO_ComboBox1, "3" + gLink("33"))
ListAdd(COMBO_ComboBox1, "4" + gLink("44"))
ListAdd(COMBO_ComboBox1, "5" + gLink("55"))
ListAdd(COMBO_ComboBox1, "6" + gLink("66"))
ListAdd(COMBO_ComboBox1, "7" + gLink("77"))
ListAdd(COMBO_ComboBox1, "8" + gLink("88"))

Whenever Modified of COMBO_ComboBox1 (server)
Info(COMBO_ComboBox1, COMBO_ComboBox1..StoredValue)


Now the results,
if button action is ajax, combo box action is ajax -> -1, Null
if button action is ajax, combo box action is not ajax -> -1, Null
if button action is not ajax, combo box action is ajax -> -1, Null
if button action is not ajax, combo box action is not ajax -> -1, Null

But if you deselect the Generation in AWP Mode box, then it works and gives the answers like 1, 11 2,22 3,33.


So as I understood now the ListAdd lines must be in the initialization code of the combo box.
Posté le 19 novembre 2018 - 23:36
I hope you could fix that, I have the same problem, and it's true...when I deselect the awp check, it works...
any thoughts about how can I fix that instead of deselect that awp check?