Skip to content

Collect values from put_html() #458

Closed

Description

@MinaGithuub

If I am using html with JavaScript code in put_html, how to get values from the code that is inside put_html so that I can decide using the needed pywebio inputs or pywebio outputs further ?

Activity

  1. changed the title [-]Custom captcha login[/-] [+]Collect values from put_html()[/+] on Aug 19, 2022
  2. wang0618 commented on Aug 24, 2022

    @wang0618
    Member

    Refer to #273

    from pywebio.output import *
    from pywebio.io_ctrl import output_register_callback
    
    
    def click_callback(val):
        put_text(val)
    
    
    def main():
        callback_id = output_register_callback(click_callback)
    
        put_html("""
        <button onclick="send_data()">Click me</button>
        <script>
        function send_data(){
            WebIO.pushData('data', %r)
        }
        </script>
        """%callback_id)
    
    
    start_server(main, port=8080, debug=True)
  3. locked and limited conversation to collaborators on Aug 24, 2022
  4. converted this issue into a discussion #464 on Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions