How to get attribute's value from a text box?

If you put code in that last post you need to use the code tags around it so it shows up!.

Any way here is a quick example.

The sliders are just normal rectangles with ids and class name.

No need to be in head.

Example config at scene load.

 $( "#item1" ).slider();
    $( "#item2" ).slider();
    
    $( ".selector" ).on( "slide", function( event, ui ) {
  
 hypeDocument.getElementById(event.target.id + 'result').innerHTML = ui.value
   
    
    
    } );

When mail button is clicked.

var mailto = document.querySelector('#targetEmail').value;
itemValues = []
 			
 			//win = window.location.href = 'mailto: ' + mailto
 			var sliders = $(".selector");
 			sliders.each(function(e,ob) {
 			var val = $(ob).slider( "value" )
 			itemValues.push(ob.id + " = " + val )
 			
 			});
 			
 			var results =itemValues.toString().replace(",","%0D%0A")
 		
 	win = window.location.href = "mailto:"+ mailto  + "?subject=report&body=" + results


jquerySlider_Mailto_MHv1.hypetemplate.zip (18.9 KB)

1 Like

Great Thanks for your Help! I am taking a look and Trying!
I just wanna say “YOU ROCK!”

3 Likes

Hi, I have been trying to use \n to having a New Line. but it seems it is not working for the string.
Could anyone give me a hint? thanks a lot!

Use %0D%0A

2 Likes

Hi Thanks very much for your help with the sliders. But I have encountered a few problems while I was testing the slider features and the “mail” function with HypeReflect with my iPad.

  1. the sliders cannot be swiped with my finger
    (since my final deliverable is an IOS app, it is important for it to be working on iPhone and iPad screen)
    Could anyone have any clue how this could be fixed.

  2. For iOS developer, which way is the best to preview (when creating App with Hype)? (with xCode or in HypeReflect) This is my first time to try to craete an app. Please advise.

  3. the mail button function works perfectly in my computer (mac book), but it does not seem to be working in HypeReflect environment. The Mail app doesnt appear in my iPad. How should I test this mail feature with my iPad or iPhone ?

THanks a lot for your attention! Any help and suggestion will be greatly appreciated! Thanks!

This is an issue with jquery ui sliders. I googled and found a solution is to include touch punch after your other script includes in the head:

<script src = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.3/jquery.ui.touch-punch.min.js"></script>

It depends on "best" as Hype Reflect is the easiest, but may also be the least accurate. Previewing in your project will be the most accurate. Second to that is may be previewing in Mobile Safari depending on your app (as Hype Reflect is a WKWebView in an app, so in some ways this could be better).

Hype Reflect does not handle mailto: links; it is not a problem with the code. IF you use the Safari icon in Hype Reflect and preview in Safari it will work fine. You may need to explicitly handle this in your app, depending on the setup.

Hi Thanks for your information!
For question 1) thanks for your suggestion to include the “touch punch” script.
I did try putting that script in the head < > file.
But it still does not seem to be working when it comes to previewing with Hype reflect.
Could you please show me how I could correct the script? The attached image show the lines of my head file.
Thanks a lot for your following up!

What you have looks the same as mine; all I needed to do was add that one line. I’ve attached a zip of my document.

I’m able to grab the slider and move it around in Hype Reflect.

slider-fixed.hype.zip (18.1 KB)

1 Like

Thanks a lot! It works perfectly! Now the sliders work in Hype reflect .

But, There are some other problems I encounter.
my questions are :

  1. how can I reset the slider’s value back to Zero? (because now every time when the player visit the slider page again. The sliders do not refresh themselves. )

I tried to put the following script inside the head script file but it did not work.
Thanks a million and please advise.

<script type="text/javascript">

window.onpageshow = function(event) {
if (event.persisted) {
window.location.reload();

}

};

  1. by the way, I have found the sliders disappeared when I try to preview in xcode’s iphone simulator. The sliders appears perfectly in the web browser . it looks incomplete with the xcode’s iphone simulator. (i already downloaded the latest xcode version today). Please suggest! Thanks

The attached image shows the sliders look incomplete in the iPhone simulator.

1,
Reset the slider with

   $( "#item1" ).slider('value',0)
   $( "#item2" ).slider('value',0)

i.e

$( "#item1" ).slider();
    $( "#item2" ).slider();
    
   $( "#item1" ).slider('value',0)
   $( "#item2" ).slider('value',0)
    
    $( ".selector" ).on( "slide", function( event, ui ) {
  
 hypeDocument.getElementById(event.target.id + 'result').innerHTML = ui.value
   
    
    
    } );
1 Like

Great thanks for the reset code! They work perfectly!
by the way, I have found the sliders’ tips disappeared when I tried to preview them in the xcode’s iphone simulator. The sliders appears perfectly in the web browser but it looks incomplete with the xcode’s iphone simulator. Please suggest! Thanks
[/quote]

Not sure what that is.. ??

I know in a normal browser I had the whole of the slider widget disappear on me at one point but not been able to repeat that.


In Xcode I normally plug my iPhone or iPad in and use that. For me this gives me a closer real world experience of how code will run. Thats not saying the simulator does not work. It is a Marvel but I just prefer to use something with the real Hardware if I can.

I use the simulator only for layout change testing in an App for devices I do not have. But that just me.

Hi! I am now submitting this iOS to Apple for verification but the Big problem is I suddenly find the mail button does not work when I preview it in Xcode and created a build and have it displayed in my iPAD. (the mail button so far only work if I use the internet browser in my computer and with my iPad’s web browser). Please help, since this is my App’s key feature. (final nail of the coffin before submitting to Apple )

In short, how could I get the mail button work when creating an iOS app? (building it with xCode. )

Try this out?

1 Like

Hi , thanks for your reply.
my original script “mail()” in Tumult in Hype contains
win = window.location.href = “mailto:”+ mailto + “?subject=speakNcomm Report&body=”

Could yo please give me a hint of how I could amend or update my current mail() script? (in order to get my mail button work in xCode for iOS app )

Any help will be very much appreciated! Please help! Thanks!

Did you try the suggestion above?

Yes, I have tried that.
I added the following code in the mail() , then i preview it with Xcode on my iPad screen. The mail button does not work.

Please suggest.
Thanks for your attention!

What ? wait!..

The Objective - C code should be in your Xcode code. And probably in there it is using swift…???

Not in a Hype function!. :open_mouth:

Thanks for your attention and following up.
unfortunately, swift is a bit out of my knowledge as my reason to purchase and use Tumult Hype is I wanted to use it to help me to create my iOS app without too much coding. It is because I am from the art background. Please suggest how I could possibly get that button working again in iOS environment? (previously the button was working but only in the web browser. )
Please help. Any help will be appreciated!

This is beyound the normal scope of this forum…

But if you are able zip a copy of you xcode project you are using and PM it to me I will see if I can add the code to a copy to do the open in mail. ( no promises )

If so PM it without your hype files. I say this so you are not giving away anything related to your actual app.

1 Like