facebook

Button to Text Field: CLOSED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

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

    PBXhowTos
    Member

    Hey there,

    I am new to MobiOne and I am trying to make a simple app but I am stuck at being able to do a certain function.

    I have a button next to a text field and I want to populate the text field when I push the button with the current time.

    any ideas how I can do this? I have tried many ways but have been unsuccessful.

    thanks in advance!
    CJ

    #331460

    Hi CJ,

    I posted a solution for a similar request here: http://www.genuitec.com/support-genuitec/viewtopic.php?p=6288#p6288

    Hope it helps to you.

    #331466

    PBXhowTos
    Member

    @support-octavio wrote:

    Hi CJ,

    I posted a solution for a similar request here: http://www.genuitec.com/support-genuitec/viewtopic.php?p=6288#p6288

    Hope it helps to you.

    I saw this post but that did not help me.

    I made a simple button, textfield app. When I click on the button, nothing gets populated into the textfield. do I need to do something to some other file for this to work?

    #331481

    Hi CJ,

    Could you share the line of code that is not working for you to populate your text field? I suspect that is a syntax error.

    #331492

    PBXhowTos
    Member

    @support-octavio wrote:

    Hi CJ,

    Could you share the line of code that is not working for you to populate your text field? I suspect that is a syntax error.

    Here you go:

    //update the text of the input field
    $('#m1-StatusUpdateApp-textField2').val('TIME NOW')
    
    #331498

    Hi CJ,

    Please try with:

    $('#m1-StatusUpdateApp-textField2').text('TIME NOW')

    Let me know how it goes.

    #331500

    PBXhowTos
    Member

    @support-octavio wrote:

    Hi CJ,

    Please try with:

    $('#m1-StatusUpdateApp-textField2').text('TIME NOW')

    Let me know how it goes.

    changed it to that and nothing happens. I click the button and the text field does not update.

    #331502

    Q: is this a secondary screen? Where are you adding this code? Do you have more than one <Design-name>_custom.js file?

    #331508

    PBXhowTos
    Member

    @support-octavio wrote:

    Q: is this a secondary screen? Where are you adding this code? Do you have more than one <Design-name>_custom.js file?

    To test, all I did was drop a text field and a button as soon as a new project is started. Then I added the code to the button on JavaScript action. That’s it.

    #331510

    PBXhowTos
    Member

    Here is what I did exactly.

    http://www.youtube.com/watch?v=YvqYCoyoROw

    #331542

    support-michael
    Keymaster
    #331544

    PBXhowTos
    Member

    @support-wayne wrote:

    Please see this collection of snippets:
    http://www.genuitec.com/mobile/docs/javaScriptSnippets/javaScriptSnippets.html#input_field_widget_snippets

    I did. Hence where I got the code from and does not resolve the issue. Do I have to put the entire HTML code in the JavaScript box? did you see my video of how I added the button and text field?

    thanks.

    #331546

    support-michael
    Keymaster

    Try either of the following snippets

    
    //jquery selects the node by its id
    $('#m1-Untitled3-textField1').val(123)
    
    //jquery selects the node that ends with the string textField1
    $('[id*=textField1]').val('123')
    #331548

    Hi PBXhowTos,

    I suspect that next line that you shared is OK, just the textField should be textField1, could you try again with this? @PBXhowTos wrote:

    Here you go:

    //update the text of the input field
    $('#m1-StatusUpdateApp-textField2').val('TIME NOW')
    
    $('#m1-StatusUpdateApp-textField1').val('TIME NOW');

    In case that the problem continues let me know to share a simple example.

    #331557

    PBXhowTos
    Member

    @support-wayne wrote:

    Try either of the following snippets

    
    //jquery selects the node by its id
    $('#m1-Untitled3-textField1').val(123)
    
    //jquery selects the node that ends with the string textField1
    $('[id*=textField1]').val('123')

    Thank you!! That worked.

Viewing 15 posts - 1 through 15 (of 18 total)
Reply To: Button to Text Field: CLOSED

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