-
Juliavor 5 Jahren #18002
Hello!
How is it possible to trigger a button on my mobile (IOS) in Simplifier app?
It works fine with ‘click();’ event in preview mode on PC, but I can’t make it work on a mobile device.Thanks for your help!
Julia
jonas.rauschHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)vor 5 Jahren #18024::Hello Julia,
The jQuery .click() event only works with a mouse.
If you want to have a mobile ready event, you can use the “touchstart” or “touchfinish” events.
But you can also use the .press() event of the UI5 button.
This can easily be done in the process designer of you Simplifier Application.
DinkelHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)DinkelHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)jonas.rauschHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)DinkelHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)Juliavor 5 Jahren #18065::I try to reduce the tip actions for the users.
When the dialog with the file uploader opens, i want the file uploader button to be “pressed” automatically, so the users don’t have to press the button every time they take a picture (they’ll take a lot of pics every day).
It would be best to also start the camera automatically and have an “upload from device” function in the camera as usual on a iPhone. But that’s optional.
jonas.rauschHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)vor 5 Jahren #18070::Hi Julia,
Could you describe your use case in a few words?
If you are using a Ui5 button, you can call the press event via script like this:
sap.ui.getCore().byId(“[buttonID]”).firePress()
If its a “normal” Html button, you first need to attach a press event via script and then fire it via script.
DinkelHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)vor 5 Jahren #18072::You try the following:
Add a button (sap.m.Button) and add the following to the press event like you did in a post above.var fileUploader = $(‘#Create_Image–ui_unifed_FileUploader-fu’);
if (fileUploader !== null)
fileUploader.click();Then add to the onAfterRendering of your screen the following code:
$(‘#Create_Image–ui_unifed_FileUploader-fu’).change(function() {
$(‘#Create_Image–ui_unified_FileUploader1-fu_form’).submit();
});Now hide the button with a CSS rule which says
display: none;
Now you can trigger the hidden button with
sap.ui.getCore().byId(“Id_Of_The_Button”).firePress()
On this way the file chooser will appear automatically.
@jonas.rausch You can’t fire the press event on this way because she uses sap.ui.unified.FileUploader which is a form with an input of type file.
Juliavor 5 Jahren #18076::Hi Dinkel,
I’ll annotated your post in bold letters here.
___________
Add a button (sap.m.Button) and add the following to the press event like you did in a post above.
I guess you mean a additionally button in the same screen as the FileUplaoder? Ok, done that.var fileUploader = $(‘#Create_Image–ui_unifed_FileUploader-fu’);
if (fileUploader !== null)
fileUploader.click();Then add to the onAfterRendering of your screen the following code:
You mean to the screen containing the buttons, right? Ok …$(‘#Create_Image–ui_unifed_FileUploader-fu’).change(function() {
$(‘#Create_Image–ui_unified_FileUploader1-fu_form’).submit();
});Now hide the button with a CSS rule which says
I’ve guessed you mean I should hide the new button? Ok …display: none;
Now you can trigger the hidden button with
Done that too …sap.ui.getCore().byId(“Id_Of_The_Button”).firePress()
On this way the file chooser will appear automatically.
But unfortunately nothing happens.__________
Have I done something wrong?
Best regards
JuliaMathieu RollHas successfully completed the online course IntroductionHas successfully completed the online course Intermediate (200)Has successfully completed the online course Advanced (300)Has successfully completed the online course Basics (100)vor 5 Jahren #18195::Hello Julia,
for Desktop and iOS you can use this Code.
$(sap.ui.getCore().byId(“Create_Image–ui_unifed_FileUploader”).FUEl).trigger(“click”);
On Android this doesn’t work because google is blocking it and you will only get an error messge saying.
“File chooser dialog can only be shown iwth a user activation.”
An other way to create and read pictures is by using the mobile action (Capture Image).
The Mobile Action is giving back a FileUrl and with the Client Side Business Object SIMP_FileHelper and the Function readFileByUrl you can read the Image.
It is giving you back the blob and base64 for the Image with the given FileUrl.
If you do not have the Business Object you can download it from Here
Note: The Mobile Action can only be used with our Simplifier Mobile Client for iOS nad Android
You must be logged in to reply to this topic.