I don't know Deform, but have done some similar things in the past so may 
be able to offer a hint or two.

1. You can grab the container that all the form elements are in in jquery - 

var dom_container = $("#item-deformField1");

2. then, within that node, you can grab each group... ".deform-seq-item"

3. and within each group, you can find the name/age using a jquery selector
'type="text" name="name'

In terms of detecting a change, that's tricky because the dom elements I'd 
want to bind triggers to are already used.  The best way would be to bind a 
keypress event to the fields, but they're automatically created by clicking 
the add-person button.  

I would create a custom function that binds your keypress function to 
detected text fields, then invokes the `deform.appendSequenceItem` 
function.  I think this may be doable by binding a setup function to the 
AddPerson button to overwrite it, and also invoking the proper 
`deform.addCallback` yourself   
https://docs.pylonsproject.org/projects/deform/en/latest/widget.html#widget-javascript

There may be a better way.   I hope there is!  This just popped out to me.

What looks to be relevant bits of the dom structure it makes is below:


<fieldset class="deform-form-fieldset">
 <div class="form-group item-people" title="" id="item-deformField1">
 <label for="deformField1" class="control-label required" id=
"req-deformField1"> People </label>
 <div class="deform-seq" id="deformField1">
 <div class="deform-seq-container" id="deformField1-orderable">
 <div title="" class="form-group row deform-seq-item item-person" style="
display: none;">
 <div class="form-group item-name" title="" id="item-deformField6-KZhZJP" 
style="display: none;">
 <input type="text" name="name" value="" id="deformField6-KZhZJP" class=" 
form-control ">
 <div class="form-group item-age" title="" id="item-deformField7-KZhZJP" 
style="display: none;">
 <input type="text" name="age" value="" id="deformField7-KZhZJP" class=" 
form-control ">

 <a href="#" class="btn deform-seq-add" id="deformField1-seqAdd" onclick="
javascript: return deform.appendSequenceItem(this);">
 <small id="deformField1-addtext">Add Person</small>
 </a>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/873f0986-043d-40e2-8966-e82c4f24785e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to