Passing Form Vars to a CFC
I am trying to pass Form variables to a CFC. Yes, the CFC
works being called from Flex, with no arguments, but being new to
Flex I am not sure how to post the values in the form fields back
to the CFC. So my questions are:
1) how do you reference form variables. They are all enclosed
in a form tag, and then by form item tags, I have a variety of
types of inputs
2) How do you pass that information to the cfc? Currently I
am using this code: getSearch.getSearch.send({values:vals});
In an attempt to pass an array full of values to the CFC.
Any help would be great!
Thanks,
Rob
I know exactly where you are coming from...LOL..
I was there too. Here is what you can do to make it easy on
you.
You wrap them in an object.... It is as simple as that.
say that you have multiple form items.
if you are using a data typed object ( I recommend it) you
would do something like this to pass form data to a cfc
// This creates a data typed object called object.
var obj:AS01Phone = new AS01Phone;
//Populate the data typed object with your form data
obj.UserID = Number(userid);
obj.PhoneType = String(_phoneType.selectedItem.KeyValue);
obj.DialCode = Number(_dialCode.selectedItem.DialCode);
// Now send it to the cfc for processing
// [RemoteObject.method(object);]
roPhone.save(obj);
Similar Messages
-
I have no problem passing a query object to my Flex app and
use it to populate a datagrid (arraycollection).... however, I want
to use this same data to update the database when the user clicks
on save, and instead of looping through each row (calling my
remoteobject each time) is there a way I can format this
information into an array, array collection or some other form of
flex object and pass ti back to another cfc function to do the
update?????
I've read elsewhere that its possible to do with a
remoteobject, however, my attempts were futile and I cannot find an
example anywhere.
I cant find a solution anywhere so and help would be
appreciated.Here is a simple example I just wrote real quick. This is how
I normally go about passing something an array of items to
Coldfusion. Hope this helps.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.managers.CursorManager;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
[Bindable] private var apples:Array = new Array(
{name:"Normal Apple", color:"Red"},
{name:"Sweet Apple", color:"Ged"},
{name:"Rotten Apple", color:"Brown"});
private function createApples():void {
AppleManager.Create_Apples(apples);
private function createApplesResult(event:ResultEvent):void
Alert.show("You have successfully added some apples into our
system.", "System Notice");
]]>
</mx:Script>
<mx:RemoteObject
id="AppleManager"
destination="ColdFusion"
source="cfc.AppleManager"
endpoint="Your endpoint here"
showBusyCursor="true"
fault="CursorManager.removeBusyCursor();Alert.show(event.fault.message,
'System Notice')">
<mx:method name="Create_Apples"
result="createApplesResult(event)"/>
</mx:RemoteObject>
<mx:Button x="10" y="10" label="Create Apples"
click="createApples()"/>
<mx:DataGrid left="10" right="10" top="40" bottom="10"
dataProvider="{apples}">
<mx:columns>
<mx:DataGridColumn headerText="Apple Name"
dataField="name"/>
<mx:DataGridColumn headerText="Apple Color"
dataField="color"/>
</mx:columns>
</mx:DataGrid>
</mx:Application> -
How to pass a variable into a cfc?
prior to calling the cfinvoke, I have coding that determins a
variable "X"
I need to pass X into a cfc so it can complete the query held
there.
So I tried
<cfinvoke component="A"
method="AList"
returnvariable="AResults">
<cfinvokeargument name="x" value="#X#"
/></cfinvoke>
correct so far?
Now over on the cfc page is where I'm getting stuck
Inside my cffunction I'm adding <cfargument name="X" />
But how do I get the value in?I don't quite understand your question. Can you rephrase?
But before all that, bear in mind that one doesn't pass a
variables into a
*CFC*, one passes it into a function within the CFC. And as
with all
functions, one passes values into the function by passing it
as an
argument. But - of course - the function has to be coded to
expect the
argument.
Your own sample code demonstrates this in action:
<cfinvokeargument name="abbrCode"
value="#companyAbbrCode#" />
(NB: lose the trailing slash: this is CFML, not XML).
So you know how to do that.
Hence me not quite understanding what you're actually asking.
Adam -
Passing form values to a Servlet
I am trying to pass form value to a servlet once the user presses the submit button. How can I get access to the form values?
ThanksTry this in your servlet.
HttpSession session = request.getSession(true);
System.out.println(request.getParameter("xxxxx").toString());
xxxx is the parameter name..
Doesn't this work? -
i want to pass form parameters to a servlet for processing i.e. i have a username and password here is my form code. does the action clause have to append the username and password or does it do it automatically?
<form name="form1" method="post" action="<%= response.encodeURL("/bookstore/controller?action=login&username=username&password=password") %>">
<p>Username:</p>
<input type="text" name="username">
<p>Password:</p>
<p>
<input type="text" name="password">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>The form does it automatically.
Your action only has to be "/bookstore/controller?action=login" -
Passing FORM parameters when opening form from a JSP
Hi,
is it possible to pass form parameters when opening the form from a JSP as a URL. If yes then what should be the way in which parameters has to be passed.
thanks.Hi,
Sorry there was some confusion.
I want to pass parameters to a (D2K) form from a JSP. I'm able to open the D2K form but unable to pass the parameters into that form.
Is it possible to pass parameters to D2k FORM from a JSP...
Thanks -
Passing FORM variables through CFSET
I am writing an account creation page for my site. After the
user inputs the required information, I would like to 1. confirm
that their email is not a duplicate of another user 2. Pass them
off to another page that allows them to confirm the information
that they input and submit the info to the database. I would like
to have the email confirmed on that page through passing the
FORM.email variable to the #CGI.SCRIPT_NAME#. If the RecordCount on
the query for duplicate email addresses comes back VALUE=0, use
CFLOCATION to pass to the next page with the FORM variables intact.
However, as forms can only have one action attribute, what is the
best way to do this, in your opinion?
Thanks so much for your help!
danuse session var to store form data:
- user submits form.
- form posts to same page (to itself).
- check for duplicate email
- if no duplicate found, copy form to a sesion var and
cflocate to next
page; if duplicate found show error to user
- on next page display user-submitted data from the session
var
make sure session vars are enabled in cf administrator and
sessionmanagement is enabled in your appliction.cfm/cfc
Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/ -
Passing form field values, to an external script, in a URL
We have a Dynamic, Reader Extended, Livecyce form from which we need to pass two user selected values to an external script. The values need to be passed via a URL, and cannot be static entries, but need to change based on user input.
I have tried variations on the following example, without success.
form1.page1.button::click - (JavaScript, client)
var userselected1;
userselected1 = form1.page1.field1.rawValue;
var userselected2;
userselected2 = form1.page1.field2.rawValue;
xfa.host.gotoURL("http://ourdomain.com/script.php?selected1=userselected1&selected2=userselected2");
Thanks,
RonGot it!! There is probably a more elegant method for achieving this, but the script below works for us. A new page opens in a browser, and displays information related to the variables passed to the script.
form1.page1.button::click - (JavaScript, client)
newURL1 = 'http://ourdomain.com.com/script.php?selected1=';
newURL2 = userselected1;
newURL3 = "&selected2=";
newURL4 = userselected2;
myNewURL = newURL1+newURL2+newURL3+newURL4;
app.launchURL(myNewURL, true);
Hope this helps someone else!! -
How can I pass a var value between MovieClips?
New week, new question.
I haven't been able to find the answer to this: I'm working with a var defined in the main timeline var score:int; , wich I use in 10 different movie clips using var score = MovieClip(this.root).score;
Everything works perfect on the first MovieClip, but when the next one plays score does not keep the value assigned in the previous MovieClip therefore the score is lost.
The clips are questions and they are place on the main time line in different frames and main time line actions layer which only contains this:
stop();
var score:int;
nextQuestion.addEventListener(MouseEvent.CLICK, newQuestion);
function newQuestion(evt:MouseEvent):void {
nextFrame();
covers each frame with every different MovieClip.
What I need to know is how to make that value pass to the next Movie Clip?Hi Ned,
I had defined the score var in the time line but to add the score from each question (MovieClips) I have to call it to the each MovieClip and I assume that whe I call the score var in the second MovieClip will keep the score from the first, but is not the case:
This is the time line actions layer:
stop();
var score:int;
nextQuestion.addEventListener(MouseEvent.CLICK, newQuestion);
function newQuestion(evt:MouseEvent):void {
nextFrame();
and this is the code from the first question (MovieClip)(all the questions will have the same code except for some specific things like the value that each answer adds to the score and stuff like that)
stop();
var score = MovieClip(this.root).score;
var answersArray:Array = new Array();
var strikeCount:int;
var sucessCount:int;
var messageBox:TextField = new TextField();
messageBox.text = "" + score;
addChild(messageBox);
messageBox.textColor = 0xFF0000;
messageBox.width = 200;
messageBox.height =100;
messageBox.x = 285.5;
messageBox.y = -32.9;
this.strikeOne.visible = false;
this.strikeTwo.visible = false;
this.strikeThree.visible = false;
this.flipQ1One.visible = false;
this.flipQ1Two.visible = false;
this.flipQ1Three.visible = false;
this.flipQ1Four.visible = false;
function answListener(evt_obj:Event){
if((strikeCount >=3) || (sucessCount ==4)) { nextFrame();
}else if (answersArray.indexOf(answ_input.text) < 0){
if(answ_input.text == "5"){
score = score + 61;
messageBox.text = ""+ score;
this.flipQ1One.visible = true, flipQ1One.play();
sucessCount = sucessCount +1;
answersArray.push(answ_input.text);
answ_input.text = "";
else if (answ_input.text == "3"){
score = score + 25;
messageBox.text = ""+ score;
this.flipQ1Two.visible = true, flipQ1Two.play();
sucessCount = sucessCount +1;
answersArray.push(answ_input.text);
answ_input.text = "";
else if (answ_input.text == "4"){
score = score + 8;
messageBox.text = ""+ score;
this.flipQ1Three.visible = true, flipQ1Three.play();
sucessCount = sucessCount +1;
answersArray.push(answ_input.text);
answ_input.text = "";
else if (answ_input.text == "2"){
score = score + 3;
messageBox.text = ""+ score;
this.flipQ1Four.visible = true, flipQ1Four.play();
sucessCount = sucessCount +1;
answersArray.push(answ_input.text);
answ_input.text = "";
else {answ_input.text = "";
strikeCount = strikeCount + 1;}
answ_input.addEventListener("enter", answListener);
function strikesListener (evt_obj:Event) {
if ((strikeCount == 1) && (answ_input.text != "5", "4" , "3" , "2")) {this.strikeOne.visible = true;
else if ((strikeCount == 2) && (answ_input.text != "5", "4" , "3" , "2")) {this.strikeTwo.visible = true;
else if ((strikeCount == 3) && (answ_input.text != "5", "4" , "3" , "2")) {this.strikeThree.visible = true;
else {}
answ_input.addEventListener("enter", strikesListener) -
Having trouble passing form values to a data action in 10G
I have a view object that queries the hr.departments table. In the app module, I created a custom method to bind a paramter to the query. I am able to make this work only if I manually enter a value for the paramsNames[0] value for the dataaction. When I run it with say the value of 1700, it returns the correct data (I run this by right-click and run on the dataaction that binds the valule).
What I want to do now is have a form on a jsp that looks like the following:
<html:form action="bindDeptLoc.do">
<input type="text" name="locationid"/>
<input type="submit" value="Submit"/>
</html:form>
.. pass the "locationid" value to the bindDeptLoc dataction for the binding. I noticed that J-Dev automatically created a default form bean called DataForm. I tried to add a form-property with the name of the form field (locationid), but that didn't work. I then tried to create another form bean called login and added the locationid form property to it and associated the form bean with the dataaction).
When I run this I get the following error:
javax.servlet.jsp.JspException: Cannot find ActionMappings or ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:798)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
at untitled1.jspService(untitled1.jsp:13)
[untitled1.jsp]
It won't even load up the jsp form. Any help on this?In the paramsNames[0] node instead of your fixed value use param.locationid which is the indicator to use the value from that field in the JSP.
-
Passing form field name to the subject line of the task assign email
Hello Everyone,
I am trying to create a process that need to pass one of the field data from a form to the task email assign but could not make it work right as expected. I think I miss something but could not figure it out myself. If any one has done this before, please share your knowledge.
Thanks in advance,
Han DaoHi Jasmin,
I thought it simple thing to do by passing the xPath to the subject line but for some reasons, it does not work instead it show the whole xpath on the subject line. Here is my xpath:
{$/process_data/FormData/object/data/xdp/datasets/data/FSFIELDS_/Form1936/EmpInfoSub/UserM gr$}
where Form1936 is the pageName, EmpInfoSub is sub-form, and UserMgr is field name on the form.
Thanks,
Han Dao -
CAN I PASS FORM VARIABLES TO THE DATABASE PROCEDURE IN PERSONALIZATION
When I try to use form variable in the database procedure call from personalization I get the attached error.
Under forms personalization
From Actions tab --> builtin --> Execute Procedure when I call a database procedure and pass one of the form variable as parameter I get "ora-01008 couldn't be validate" error
Can we pass on form variables to the database package using personalization ? If yes, then is this the right way?
Message was edited by:
omitchelI tried customizing the Quoting Form, it works.
What you have done is correct, but this is how you call it
='begin
db_proc('''||${item.qothddet_main.quote_name.value}||''');
end'
here
qothddet_main : block name
quote_name : item name
Thanks
Tapash -
How can Parameter passing Form 6i to Report 6i
Hi,
I want to send a parameter from the Form 6i to run a report 6i which is used in where clause of a query. Who can I send this parameter???
Please send me solution of this problem.
ShahzadThere are dozens of threads on this site regarding this topic.
Did you bother to search first?
Try pass parameter to report paramater form from a form -
Passing form variables in a single form
I am trying to make a form to select a starting and ending
month for a event search.
I have 2 list boxes populated with the months, but I want the
second box to begin from the first selection.
So if the user selects may in the first box, the second box
should list from may to december.
Is there any way to pass a form variable to another field
inside the same form?
I want to use a conditional <cfloop> to populate the
second box like <cfloop from= #variableA# to= 12>
then have the <options> inside the loop.
Thanks in advance for any help you can provide...this one has
me stumped!You can do it with javascript. Google related selects, there
are lot's of examples out there.
What happens if the user selects December in the 1st
box? -
Forms personalyzation, passing Form field values to SRS concurrent request.
Hi,
Iam calling an SRS from forms personlization. Can any body tell me how to pass the Form field values as parameters to the Reports. (Example when they call this Concurrent request from Transactions screen, The invoice number should be defaulted in the report parameter).
Regards,,
Anil.Hi,
You can use FND_REQUEST.SUBMIT_REQUEST to submit a concurrent progrm with parameters given.
For example, get the invoice number into v_invoice_no and call a function included code bellow.
FND_REQUEST.SUBMIT_REQUEST(
<app_short_name>,
<concurrent_short_name>,
to_char(SYSDATE,'DD-MON-YYYY HH24:MI'),
FALSE,
v_invoice_no,chr(0),'','','','','','','','',
'','','','','','','','','','');-- 100 ARGUMENTS FROM THE BEGINNING
Where chr(0) must be the last argument.
Maybe you are looking for
-
Problem with nesting repetitive groups, using PDF as template
We are trying to use a pdf file (Acrobat 5.0) as a template for BI Publisher reports. Our report uses as a data source a xml file (facturas.xml) with data from several bills. In each bill, there are areas where multiple lines must be displayed. We us
-
How do I reset my security questions that I never made?
My account won't let me buy anything until I answer security questions. But I never made any. When I went to try and answer them they said they were wrong. So I ws wondering how i could reset my questions because I am so confused and FRUSTERTED!!!
-
Hi all, while creating RFQ in tcode ME41, there is an option to create RFQ with reference of PR and that option also provide selection of open PRs only. I want to change this option as Open PRs on a particular date interval. Any idea to do this witho
-
Hi , I have read the documentation of wlp 10.3 regarding drag drop tags but have not got the idea as of yet. How do i use them exactly ? after initiating the basic structure in the jsp using <dragdrop:dragDropScript/> i create a draggable resource as
-
Bankapp on Windows 2000 Error 466
I have been attempting to run the Bankapp sample application which comes with Tuxedo 8.0 and a Windows 2000 server. I believe I followed all of the instructions for compiling and configuring the application. When I execute tmboot -y from the command