Ok, let me refrase that...

Most of the forms samples contained in Cocoon are about:
1. Load something in the form from a Bean or XML
2. Display the form with the content loaded
3. Edit the form (add or remove rows)
4. Submit the form and display a success page

What I trying to achieve is:
1. Display the form empty
2. Some event inside the form triggers a javascript function (a combo, or a
button...)
3. Inside that function I want to load something from the XML inside the
form“s repeater, *without* a full page reload (ajax=true)

Every time I try to manipulate the form object inside the function, I
receive errors as 

org.mozilla.javascript.EcmaError: load is not a function.
org.mozilla.javascript.EcmaError: createBinding is not a function.

What is the required way of doing a ajax 'search and populate' form screen ?

I am using cocoon 2.1.9.


-----Mensagem original-----
De: Gustavo N. Fernandes [mailto:[EMAIL PROTECTED] 
Enviada em: segunda-feira, 28 de agosto de 2006 21:06
Para: [email protected]
Assunto: Search screen

Hi,

How can I populate a repeater when some event occurs in the form? Imagine I
have a drop-down (filter) that when changed causes the repeater to be
populated based on the drop-down's choice:

Form-definition:
----------------

<fd:field id="list">
        <fd:selection-list src="cocoon:/groups"/>       
        <fd:datatype base="string"/>    
                <fd:on-value-changed>
                        <fd:javascript>
                                upd(event);
                        </fd:javascript>
                </fd:on-value-changed>  
</fd:field>
<fd:repeater id="rep">
                        <fd:label> Comments </fd:label>
                        <fd:widgets>
                                <fd:output id="id">
                                        <fd:datatype base="string">
                                          </fd:datatype>
                                </fd:output>
                                ...
                        </fd:widgets>
                </fd:repeater>

Flow:
----
// Initialize the form and display (empty at first time)
function registration(form) {   
        var form = new Form("formdefinition.xml");
        form.createBinding("formbinding.xml");
        form.showForm("form-display-pipeline");
}


// Will populate the repeater when selection-list change
function upd(event) {
     var value = event.source.value;
     var form = event.source.form;
     var document = loadDocument("document.xml");
     form.load(document);
     return false;      
}


That gives an error:
org.mozilla.javascript.EcmaError: load is not a function.

I can successfuly alter state and value of other widgets in the 'upd'
function. I am using ajax.


TIA.

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 25/8/2006
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 25/8/2006


-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.6/428 - Release Date: 25/8/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.11.7/434 - Release Date: 30/8/2006
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to