Welcome! Log In Create A New Profile

Advanced

Javascript Clicking on a button in the form

Posted by MPD_For_Life 
Javascript Clicking on a button in the form
March 28, 2021 01:46AM
Hello and Thank you in advance for the help.

The below Javascript code helps me identify if the user is opening my application from a mobile (Android, I-phone, etc) device, or from a Desktop via a web browser.

I have a button on my main page named BTN_Open_Mobile_Main_Page, this button if clicked opens a page that adapts to the mobile device in the same Browser Tab replacing the Main Application Page.

Does anyone know how to in JavaScript process the OnClick event of this button from the below code?

if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){

// true if opened by a mobile device
//Here should be the Javascript code to Click the button BTN_Open_Mobile_Main_Page
//Which in WL is, ExecuteProcess(BTN_Open_Mobile_Main_Page, trtClick)

}else{

// false if not opened by a mobile device
// No Other Page is needed

}


Thank you so much for the Help

Best regards
just in case.... Are you aware that this functionality is available natively in webdev?
You can have one set of pages for desktop and one for mobiles, nothing to do, detection is automatic
Re: Javascript Clicking on a button in the form
March 28, 2021 05:25PM
Thank you so much Argus for your reply,

You mean that when the user type my website address from a mobile device, instead of going to the desktop page it goes to for
example a Page named "Page_Mobile_Main_Page"?, and when the login is from a desktop, it automatically goes to a Page for example named "Page_Desktop_Main_Page"?

If this is what you mean, then that does not happen for me.

I have Version 24, do I missing something? any configuration?

Thank you always for the help.

Best regards,

Carlos



Edited 1 time(s). Last edit at 03/28/2021 08:58PM by MPD_For_Life.
Re: Javascript Clicking on a button in the form
March 29, 2021 12:38PM
Hi Carlos,

It is not fully automatic.
It's called dynamic serving and you can find it in the Project, Referencing tab.

Beste regards,
Piet
Re: Javascript Clicking on a button in the form
April 02, 2021 07:24PM
Hi Piet,

Thank you for your reply and suggestion, sorry I took a little vacation and away from my PC.

let me look into it.

Thank you again.

Best regards,

Carlos
Re: Javascript Clicking on a button in the form
April 02, 2021 08:53PM
Hi Piet

I want to thank both Piet and Argus for the Help. It really helped me save lots of time..

Here is the link to the Help File on how it's done

[help.windev.com]

A remark.:

For those who want to implement this feature Please read in full.

To those implementing the association of the Pages
When you first drag and drop the Desktop Page, the Mobile Table will create a Red Empty Record, you MUST drag and Drop the Mobile Page inside this Red Empty Record in order for the association to work, if it is not done like that then it would not work.
Once the Validate button is pressed a new Progress Bar will be displayed finishing the association.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: