cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philipp Rech" <philipp.r...@gmx.de>
Subject Re: [sorry but not all done yet] RE: pass a variable from flowscript into cfrom text input field
Date Tue, 26 Oct 2004 12:25:55 GMT
okay my from definition and template look almost like this
http://cocoon.apache.org/2.1/userdocs/forms/sample.html
the only thing different is that they are split up in two
pages thus two from definitions and templates.
the reason for all that is to be able to go back to the first page 
change something and will u click on submit the second page appears with the
values u enteres before... wizard like. mybe there is even a better
soloution for this... *wonders*...

here is my flowscript. it works as i want with the input fields but not with
the boolean (checkbox!) fields called "mail". 
see: 
//(DOENST WORK)  wmail = form_2.lookupWidget("mail");
//(DOSENT WORK)  wmail.setValue(mail);


---------- the flowscript: -------------------

cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");

function registration (){
    

	var username = "";
	var email = "";
	var password = "";
	var sex = "";
	var color = "";
    	var mail = "";     //here is the boolean field mail!!!!
	var age = "";


     var form_1 = new Form("form-1.xml");

    form_1.showForm("registration-display-pipeline");
  
	var username = cocoon.request.name;
	var email = cocoon.request.email;
      var age = cocoon.request.age;
	var sex = cocoon.request.sex;
   
	var form_2 = new Form("form-2.xml");


     //here check is the value hase been chenged from "" to something
     // and if yes redisplay the old value!!!

	wfarbe = form_2.lookupWidget("farbe");
	wfarbe.setValue(farbe);
	wpassword = form_2.lookupWidget("password");
	wpassword.setValue(password);
	//(DOENST WORK)  wmail = form_2.lookupWidget("mail");
	//(DOSENT WORK)  wmail.setValue(mail);

  	form_2.showForm("registration-display-pipeline-2");

	var password = cocoon.request.password;
	var farbe = cocoon.request.farbe;
    	var mail = cocoon.request.mail;


	var model_1 = form_1.getModel();
   	 var model_2 = form_2.getModel();
    
   	 var bizdata = { "username" : model_1.name, 
                    "email" : model_1.email, 
                    "age" : model_1.age,
		     "sex" : model_1.sex,
                     "pw" : model_2.password,
  	             "mail" : model_2.mail,
			   "farbe" : model_2.farbe
			};
    
    cocoon.sendPage("registration-success-pipeline", bizdata);
   
}


-----------------------------------------------------------

thank you!
philipp






> hi philipp,
> 
> the error message seems quite clear, you have to supply a boolean
> value (true or false) to a booleanfield. if you did that it's maybe a
> javascript-java-interaction problem. can you post the actual code that
> generated the error message ? from below i can only see you try to
> set the field "test" to a non-instantiated javascript variable ...
> 
> greetings, johannes
> 
> Philipp Rech wrote:
> 
> >sorry i was too fast... 
> >the solution  
> >
> >var test;
> >
> >form = new Form("my-form.xml");
> >wid = form.lookupWidget("test");
> >wid.setValue(test);
> >
> >form.showForm("registration-display-pipeline");
> >var test = cocoon.request.test;
> >
> >
> >only works fine with input field widgets but not with booleanfield
> >widgets. There i get an error: 
> >
> >java.lang.RuntimeException: Cannot set value of boolean field "test" to a
> >non-Boolean value.
> >
> >Same as with the text field i use it to figure out if it has been
> "changed"
> >before and redisplay its old value... all to solve my multi page from
> >problem.... user has enterd a falue in page 2 and submitetd it then goes
> >back to page 1 and changes something and submits page one. now i want
> page 2
> >to be displayed again but with the data entered before!
> >
> >
> >thanks again!
> >phil
> >
> >  
> >
> >  
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message