2025-03-06, 16:17:50
CYZ
Form with no name submit
|
2025-03-06, 16:17:50
CYZ
Hello carlos,
You forgot the question, but I take it that the question is how-to programmatically submit this form? If the form would have had an id (id="login") attribute set on the form itself then you would have been able to use: Code: Private Sub SubmitButton_Click() But there is no id.. the alternative to select by name also is not available in your example form. So that suggests that there's no way to do this without going down to javascript level, or is there? Note: you can always handle these type of issues with a bit of javascript, but luckily you don't have to do that as there is an easier way to do so. An alternative way on clicking on that submit button would be to send a "click" to the button instead of submitting the form. Imagine your form had the id set to login as above then the following would work. Code: Private Sub SubmitButton_Click() This says, click on the html element that is of type input in a fieldset in the html element with an id set to "login". Fine, but we don't have the id set, let's make it more general. Code: Private Sub SubmitButton_Click() So now we're telling the AntView control to click on a html element of type input inside a fieldset which is in a form. This already works if you would test it on a html file that you presented. However.. what if html has more than one form in there that matches this selector? Can we be a bit more specific? Turns out we can. The following is what I suggest you use: Code: Private Sub SubmitButton_Click() And that.. hopefully is specific enough for your needs. edit: see also the help on ElementClickByQuerySelector for a bit more background info. -- Wil
2025-03-07, 10:13:21
(This post was last modified: 2025-03-07, 10:45:10 by carlos@agpsoftware.com.)
Hi. The subject was the question: form with no name submit
Wil: amazing. I go to test it. Anyway, your code and your explanations opens a lot of posibilities for me. Many thanks. Hi again, That worked for me. In my next step, I used again your solution: thisform.oantviewdocument_lista.ElementClickByQuerySelector(".default-btn-shortcode") And also, worked. But, result opens in a new browser window so i loose control. (target="_blank") Any help for that? html: <a class="default-btn-shortcode dt-btn dt-btn-m" href="#" target="_blank"><i class="fas fa-user-lock"></i>MI OFICINA VIRTUAL</a> CYZ
2025-03-09, 10:02:35
Hi, maybe my last post were missing:
But, result opens in a new browser window so i loose control. (target="_blank") I solved navigating to same URL in main document, but the new browse window remains open. Is there a better solution to avoid this? Thanks CYZ
Hi CYZ,
Use the event OnNewWindowsRequested to block the opening of a new window by setting Args.Handled to True. Then use navigate to browse to the URL you needed to go. The VB6 - New Window Handling example shows you in more details, but let me copy & paste the specific code I meant as it explains more than just one technique. Code: Private Sub EdgeWebBrowser_OnNewWindowRequested(ByVal Args As AntViewAx2.IAntViewNewWindowRequestedEventArgs) I just noticed you use VFP. There is an example on how-to do this too for Fox Pro in the examples of AntView version 2. edit: and now I see that the url is "#", so the same page. I guess that there's an onclick event attached to that url that handles whatever the link should do. It might enough to just block the click and not navigate. Not sure, we might be missing context. -- Wil
2025-03-10, 19:31:22
(2025-03-09, 12:39:50)wila Wrote: Hi CYZ, Thanks, Wil. I will test it. CYZ
2025-03-16, 08:16:07
If i lock the new window with args.handled = true, navigation in EdgeWebBrowser.Navigate does not work.
However, if I allow the new window to be opened, and then use EdgeWebBrowser.Navigate to same URL, that works fine. The only issue is the new opened window... remains opened and active. CYZ
2025-03-17, 10:41:10
Hi,
In principle this should work, but I suspect something very specific to your website is happening here. Without more details, it is hard to say. The only navigate that wouldn't work in the event is a sync version. In other words: NavigateSync doesn't work from an event whereas Navigate does. But that's documented, so I doubt that it is your issue. Can you contact me directly at support@antwise.com to see if we can figure out what is happening here? -- Wil
2025-03-20, 16:21:40
For anybody else reading this. The issue has been resolved.
The navigation that caused the issue was indirect by triggering a javascript click event from calling ElementClickByQuerySelectorSync. Because the synchronized method was used, the OnNewWindowRequested event was not getting triggered. By using the ElementClickByQuerySelector method instead, things started to work as expected and the creation of the new window could now be stopped. FWIW, we used the following in the OnNewWindowRequested event. Code: *** ActiveX Control Event *** If you navigate explicitly then you get to keep navigation history and the "back button" will work. If you assign the current AntView object as the "new window" then your navigation history is gone and there will be no "back button". Btw, the back button here is the "Back" option in the context (right click) menu. -- Wil |
« Next Oldest | Next Newest »
|