Threepenny-GUI: Get Attribute Value as String

290 views Asked by At

is there a way to get the attribute value (especially the id) of an element as a string? For instance the following lines result in "()":

field <- UI.new
    # set (attr "id") "some text"


on UI.drop field $ \_ -> do

    -- Some label to print the attribute value to   
    label <- getElementById window "labelID"

    id <- get (attr "id") field
    (element (fromJust label)) # set text (show id)

Since attr returns a WriteAttr, get might not be working. Is there a workaround?

Thanks in advance!

Greetings

1

There are 1 answers

0
Heinrich Apfelmus On BEST ANSWER

As of threepenny-gui v0.8.1.0, this is currently not implemented. It's certainly possible, I just haven't gotten around to do that yet. Feel free to open an issue on Github!

(Note that you can always call JavaScript directly with the runFunction and ffi functions if you are missing functionality.)