View Single Post
  #1  
Old 02-14-2011, 02:53 AM
TarkaDahl TarkaDahl is offline
Member
 
Join Date: Mar 2010
Posts: 59
Problems with vizhtml displayURL

Hi
the following code works fine

Code:
import viz
import viztask
import vizhtml

viz.go()

html = """
    <html>
    <body onload="document.the_form.first_name.focus();">

    <form name="the_form" method="post">
        <table>
            <tr>
                <td>First Name</td>
                <td><input type="text" name="first_name"></td>
            </tr>
            <tr>
                <td>Last Name</td>
                <td><input type="text" name="last_name"></td>
            </tr>
            <tr>
                <td></td>
                <td><input type="submit" value="Submit"></td>
            </tr>
        </table>
    </form>

    </body>
    </html>"""
    
vizhtml.displayCode(html)

def HandleForm(e):
    
    print "wooho form submited"
    
vizhtml.onFormSubmit(HandleForm)
However when i change to loading the html file from an external file it doesnt work.

Code:
import viz
import viztask
import vizhtml

viz.go()

vizhtml.displayURL("simple.html")

def HandleForm(e):
    
    print "wooho form submited"
    
vizhtml.onFormSubmit(HandleForm)
The html is exactly the same just put in the file "simple.html". am i doing something wrong. or is it not mearnt to work like that.

Thanks

TarkaDahl
Reply With Quote