facebook

Open Web Page Based on Text Field Value

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #327246 Reply

    Hello Again 😛

    I’m trying to get a little javascript to work..

    This is my user interface:

    I saw this on a webpage and i need it in the app it self:
    http://forums.adobe.com/message/4346863

    I tryed to change some things but i cant get it to work cuz i’m not that big of programmer :P|

    The website i Try to link is something like this:
    http://intranet.grundel.nl/roosters/leerlingroosters/index_14986.htm

    The “14986” is the number of the student. I want to set the value of the text box in the link:

    So if someone types in the text box: 14970 and presses the button the website:
    http://intranet.grundel.nl/roosters/leerlingroosters/index_14970.htm appears..

    Can someone make the javascript ‘mobione usable’ xd ?

    look out for the .htm on the end of the link. That doesn’t change..

    ~IL

    Javascript code from the website:

    if (TextField1.rawValue !== null) {
         var vURL = "http://hqms/doc.asp?dn=" + TextField1.rawValue; 
         app.launchURL(vURL, true);
    }
    else {
         app.alert("Dear user, please put a code in the text field. Thank you!"); 
    }
    #327308 Reply

    Max87
    Member

    Hello,
    try this:
    Set onClick action for button to call function open. Then, write this code:

    
    function open()
    {
    var studentNumber, link, link2;
    studentNumber = $('#m1-Untitled1-Textfield1').val();
    link = "http://intranet.grundel.nl/roosters/leerlingroosters/index_"+studentNumber;
    link2 = link+".html";
    console.log
    window.open(link2);
    }
    

    if I replace window.open to console.log, it logs correct address for me, but if not, test center shows error with jquery.
    However, I use window.open in my app and it works fine, so it should with this too.
    Please try to test it on iPhone and let me know.

    #327345 Reply

    nope it does nothing on my iphone and test centre.. just raping the button lol.. nothing happens

    i opened an other case:
    http://www.genuitec.com/support-genuitec/viewtopic.php?f=8&t=3119

    Maybe the answer will help you?
    =)

    I’ve got the trial version atm.. thinking of buying it.. isn’t their any bug or something that i can’t use java script in trial mode?

    ~IL

    #327351 Reply

    support-michael
    Keymaster

    Please see the snippet posted here for programmatically opening a URL

    http://www.genuitec.com/support-genuitec/viewtopic.php?f=8&t=3119&p=8140#p8140

    Use the proposed phoneui.showURL(“your_url_here”) api.

    #327464 Reply

    @Max87 wrote:

    Hello,
    try this:
    Set onClick action for button to call function open. Then, write this code:

    
    function open()
    {
    var studentNumber, link, link2;
    studentNumber = $('#m1-Untitled1-Textfield1').val();
    link = "http://intranet.grundel.nl/roosters/leerlingroosters/index_"+studentNumber;
    link2 = link+".html";
    console.log
    window.open(link2);
    }
    

    if I replace window.open to console.log, it logs correct address for me, but if not, test center shows error with jquery.
    However, I use window.open in my app and it works fine, so it should with this too.
    Please try to test it on iPhone and let me know.

    Hii Max 87

    I tryed it but can’t get it to work..

    What is the exactly code you typed in in the On Click “run javascript” function
    I send you the file so you can see how the texboxes etc. are called. and maybe you can change it.. 😛
    maybe you can help me again 😉

    ~IL

    Attachments:
    You must be logged in to view attached files.
    #327465 Reply

    Max87
    Member

    Hi InfinitumLyceum,
    I updated your .mobi file and Test USERID_custom.js and it works for me.
    I use phoneui.showURL as Wayne recommended.
    Please try it and let me know if it works.

    Attachments:
    You must be logged in to view attached files.
    #327514 Reply

    @Max87 wrote:

    Hi InfinitumLyceum,
    I updated your .mobi file and Test USERID_custom.js and it works for me.
    I use phoneui.showURL as Wayne recommended.
    Please try it and let me know if it works.

    Nice! thanks!
    It works now! i’m really happy Thank you Max87!
    I’m also making an app for ipad and android versions.. what’s the excactly code you typed in and can i use that code to every device (ipad, Nexus etc) ? ( and where do i put it ?)

    Btw when i click in the build centre on the button i only see as script:

    openLink();

    Don’t know if i just see that because i have the trial version? 😛

    [Problem]
    I tried to edit the UI, just the buttons underneath i changed to the correct windows.. but now the code doesn’t work anymore.. so i can’t change anything? :S or is this the trial version trolling me lol?

    ~IL

    #327515 Reply

    Max87
    Member

    Hi IL,
    I’m happy, that my code works for you. I don’t really know, what’s the difference, when you are developing ipad and android versions.
    I think, if you create GUI for ipad, name mobi file Test_USERID_ipad f.e, and create Text field named TextField1.
    Then, when you create the button, set onClick event to Run Javascript and type openLink(); in it.
    Execute the Design center, so it creates html files and copy-paste the openLink function from Test USERID_custom.js into Test USERID_ipad_custom.js.
    Change the $(‘#m1-Test_USERID-TextField1’).val() to $(‘#m1-Test_USERID_ipad-TextField1’).val() (don’t forget 😉 and reload Test center page. It should work. Let me know.

    #327516 Reply

    @Max87 wrote:

    Hi IL,
    I’m happy, that my code works for you. I don’t really know, what’s the difference, when you are developing ipad and android versions.
    I think, if you create GUI for ipad, name mobi file Test_USERID_ipad f.e, and create Text field named TextField1.
    Then, when you create the button, set onClick event to Run Javascript and type openLink(); in it.
    Execute the Design center, so it creates html files and copy-paste the openLink function from Test USERID_custom.js into Test USERID_ipad_custom.js.
    Change the $(‘#m1-Test_USERID-TextField1’).val() to $(‘#m1-Test_USERID_ipad-TextField1’).val() (don’t forget 😉 and reload Test center page. It should work. Let me know.

    Okey thanks! maybe Wayne Can answer that question..

    But i got a problem see my edit in my previous post

    #327517 Reply

    Max87
    Member

    I don’t really understand, what you did?
    You have to have a button in your screen, which has onClick event set to call openLink function. openLink fuction code has to be in your *_custom.js file, as I wrote.
    Try send me yor mobi, so I can look at it.

    #327654 Reply

    @Max87 wrote:

    I don’t really understand, what you did?
    You have to have a button in your screen, which has onClick event set to call openLink function. openLink fuction code has to be in your *_custom.js file, as I wrote.
    Try send me yor mobi, so I can look at it.

    Tnx

    ~IL

Viewing 11 posts - 1 through 11 (of 11 total)
Reply To: Open Web Page Based on Text Field Value

You must be logged in to post in the forum log in