Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Possibile errors in IWBootStrap Library
#1
Good afternoon.
I write for possible errors on the Bootstrap library.
I have attached an example project.
1)
I have an iwbsinputform with iwbsfile and an iwbsbutton inside it. I put the ButtonType property btsubmit. The onsubmit event with this code is associated with the iwbsinputform:

if aRequest.Files.Count> 0 then
begin
FileUpload: = THttpFile (aRequest.Files [aRequest.Files.Count - 1]). FileName;
WebApplication.ShowMessage ('File upload name:' + FileUpload);
end
else
WebApplication.ShowMessage ('No file selected');

After executing this code I get the error 404 - Not found. I think it's two to the rewriting of the iwbsrestserver.pas unit and the change in the management of callbacks in Intraweb 15.1.4.
2) In the iwbsradiobutton component the OnAsyncClick event does not fire and the Checked property when it changed is always False if I try to read it from code.

3) HiddenInput

I have a callback registered in the form
WebApplication.RegisterCallBack ('CalcolateValue', CalcolateValue);

In a CalcolateValue procedure:
js: = Format ('addHiddenInput ("% s",% s);', ['Test_Input', 'Test ()']);
WebApplication.CallBackResponse.AddJavaScriptToExecute (js);

the javascript function is defined as follows:

with JavaScript do
begin
Add ('function addHiddenInput (aName, aValue) {');
Add ('var frm = $ (getSubmitForm ());');
Add ('if (! Frm.length) return false;');
Add ('var hid = frm.find ("input [name =" + aName + ""] ");');
Add ('if (! Hid.length) {');
Add ('hid = $ ("<input type =" hidden "name =" + aName + ""> ");');
Add ('frm.append (hid);');
Add ('}');
Add ('hid.val (aValue);');
Add ('AddChangedControl (aName);');
Add ('}');
Add ('');
Add ('function Test ()');
Add ('{');
Add ('return 5;');
Add ('}');
end;

In a button in the scriptevents property I have
ajaxCall ("CalcolateValue", "& CallBack = 1", false);

and in the AsyncCLick event I have:
  Value: = EventParams.Values ['Test_Input'];
  WebApplication.ShowMessage (Value);

When I run ajaxcall the callback is executed but then in the button in the AsyncClick event the Value returned is always empty and not 5 as it should be. (In the same button is it possible to return the value of the variable through the callbak?)
(I use intraweb 15.1.4 and iwbootstrap 3.4.1)
Thanks for your help

Andrea


Attached Files Thumbnail(s)
   

.zip   Example.zip (Size: 54.88 KB / Downloads: 9)
Reply
#2
Can anyone give me some feedback?
Thank you
Reply
#3
Hi,

I tested your example and at least the "Test click" button is not working as expected, as it seems.

I'll debug it and get back to you ASAP
Reply
#4
Hi,

I have an update. The event handlers of IWBSRadioButton has an issue and it is not working properly. I have already fixed it but I still need to check the other issues.

The issues related to the callback execution seems to have the same origin. It should be simple to fix, but I still need to work on it.

I'll keep you posted.
Reply
#5
(09-16-2019, 10:24 AM)Alexandre Machado Wrote: Thanks for the reply

Andrea
Reply
#6
Most issues are fixed except (3)

There are a few things there that are clearly not supported:

a) Your parameter is named "Callback". You can chose any name of parameter you want except "Callback". "Callback" is exactly the name of the parameter which is supposed to carry the name of the callback call. So you need to chose something else.

b) Your button named IWBSButton2 (Get value hidden input) has 2 distinct events attached to it.
You trigger an Async request with script events (via ajaxCallback() call) and there is another Async request triggered via standard OnAsyncClick event.

I don't know exactly what is your goal there, but I don't see why you need 2 callbacks in sequence like that.
Reply
#7
(09-17-2019, 10:39 AM)Alexandre Machado Wrote: Thank you for the response.
I understood the problem about callback name.
For b the goal is to obtain with standard async click event the value of a client variable( ex. bootstrap table json) that a callback has calculate before with the call in scriptevents .
I know that for retrieve the value with hidden input i need two callback.

In the first

js:= Format('addHiddenInput("%s",%s);',['Test_Input','Test()']);
WebApplication.CallBackResponse.AddJavaScriptToExecute(js);

in the second i get the value (in the onAsyncClick Button)
Value := EventParams.Values['Test_Input'];

this work in intraweb 14.1.14 for example.

Could be a better different solution?

Thanks
Andrea
Reply
#8
(09-17-2019, 11:03 AM)Anto90 Wrote:
(09-17-2019, 10:39 AM)Alexandre Machado Wrote: Thank you for the response.
I understood the problem about callback name.
For b the goal is to obtain with standard async click event the value of a client variable( ex. bootstrap table json) that a callback has calculate before with the call in scriptevents .
I know that for retrieve the value with hidden input i need two callback.

In the first

js:= Format('addHiddenInput("%s",%s);',['Test_Input','Test()']);
WebApplication.CallBackResponse.AddJavaScriptToExecute(js);

in the second i get the value (in the onAsyncClick Button)
Value := EventParams.Values['Test_Input'];

this work in intraweb 14.1.14 for example.

Could be a better different solution?

Thanks
Andrea

Could anyone suggest if the solution is correct?
Thanks
Andrea
Reply
#9
You are clearly relying on an implementation detail in order to make this "work" (even in IW 14.1.14). There is no obligation for the ajax subsystem to wait for the first request/response cycle to be fully processed in order to send the next request...

I'll have a second look at your application and find the best way to solve it. Please hold on.
Reply
#10
In the JS world this is normal. They use Promises and other async mechanisms to deal with it on the client side.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)