how to update value= attribute

11 views
Skip to first unread message

Franklin Brauning

unread,
Nov 7, 2016, 2:44:24 PM11/7/16
to Nitrogen Project / The Nitrogen Web Framework for Erlang
I'm making a widget

<progress class="progress" value="15" max="100">15%</progress>

and I want to update that value= atribute from server

The text is wf:replace(Id, "90%"), but how about with the value= atribute?

Franklin Brauning

unread,
Nov 7, 2016, 2:51:07 PM11/7/16
to Nitrogen Project / The Nitrogen Web Framework for Erlang
wf:set(TargetID, Value)  will do it, right?

Stuart Thackray

unread,
Nov 7, 2016, 3:00:45 PM11/7/16
to Nitrogen Project / The Nitrogen Web Framework for Erlang
Replace replaces a whole element i.e. it would replace the whole progress bar. BUT nitrogen uses classes currently to replace things.That looks like html rather than erlang. so you have to set name i.e. 
<progress class="wfid_progress" value="15" max="100">15%</progress>

then use wf:set("progress", "90").

to set the value/textbox. 

I haven't tested what I said above but believe that would most likely either set value not body. If you share the css/js for the progress bar may be able to suggest something being able to test.

Jesse Gumm

unread,
Nov 7, 2016, 3:01:14 PM11/7/16
to nitrogenweb
Hi Franklin,

It depends on what attribute you're trying to set.  Using wf:set on a form element will change its value. Using it on an image will change its src attribute. 

You'll need to update the value with jquery, which can be simplified a bit with the objs(ID) javascript function:

wf:wire("objs('elementid').prop('value', '15)")


That said, modifying the #set{} action to support an attribute attribute (heh) might be a good idea:

wf:wire(Id, #set{attribute="some value"}).

And making a separate wf shortcut call for it like

wf:attribute(Id, "Some value")

Might not be a bad idea.




--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb+unsubscribe@googlegroups.com.
To post to this group, send email to nitro...@googlegroups.com.
Visit this group at https://groups.google.com/group/nitrogenweb.
For more options, visit https://groups.google.com/d/optout.



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Jesse Gumm

unread,
Nov 7, 2016, 3:02:19 PM11/7/16
to nitrogenweb
wf:set would work for setting the value attribute on the progress element because the progress element has a value attribute.

If that's all you want to set, then yes, that'll work.

-Jesse

--
You received this message because you are subscribed to the Google Groups "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nitrogenweb+unsubscribe@googlegroups.com.
To post to this group, send email to nitro...@googlegroups.com.
Visit this group at https://groups.google.com/group/nitrogenweb.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages