I'm connecting a Flex 4.6 form to SQL Server 2008 using Coldfusion. When my form submits to the DB, I'm finding my variables are crossing and I can't seem to see the problem causing it:
Flex Remote Object Call:
private function RegisterNewEmployee():void{
//remote object and method instantiated
roCreateNewUser.createNewEmployeeProfile(fm_userName.text,
fm_password.text, fm_accessLevel.selectedItem, fm_emailAddress.text,
fm_domainField.selectedItem );
}
Flex Components
<mx:FormItem label="Access Level:" width="182" color="#FFFFFF" required="false">
<s:DropDownList width="60" color="#FFFFFF" id="fm_accessLevel">
<s:dataProvider>
<mx:ArrayList id="accessLevelList">
<fx:String>9</fx:String>
<fx:String>44</fx:String>
</mx:ArrayList>
</s:dataProvider>
</s:DropDownList>
</mx:FormItem>
<mx:FormItem label="Email: " fontSize="12" width="173" horizontalAlign="left" color="#FFFFFF" required="false"><s:TextInput color="#000000" id="fm_emailAddress" text="{fm_userName.text}" />
</mx:FormItem><s:Label text="#
" fontSize="14" width="15" height="21" color="#FEFEFE" />
<s:ComboBox color="#FFFFFF" id="fm_domainField" height="22" enabled="true">
<s:dataProvider>
<mx:ArrayList id="domainList">
<fx:String>aaa.com</fx:String>
<fx:String>bbb.com</fx:String>
<fx:String>ccc.com</fx:String>
</mx:ArrayList>
</s:dataProvider>
</s:ComboBox>
Coldfusion Code:
<cfargument name="fm_accessLevel" type="any" default="1">
<cfargument name="fm_emailAddress" type="any" default="user01">
<cfargument name="fm_domainField" type="any" default="aaa.com">
Problem begins here:
<!--- Concatenate email and domain --->
<cfset emailString = #arguments.fm_emailAddress# & "#" & #arguments.fm_domainField# >
Somehow, the outcome of the concatenation returns the equivalent of
<cfset emailString = #arguments.accessLevel# & "#" & #arguments.emailAddress# >
or **44#MyUserName** in plain text output
Any noticeable issues in the code to cause this? It previously worked without
issue. Cache and browser history cleared, issue persists.
Related
In my application i have both radio buttons and check boxes. Here I want to validate both CheckBox and RadioButton when I move to the next contol.
Edit:
My coding is here
<fx:Declarations>
<s:RadioButtonGroup id="genderOption"/>
<mx:StringValidator
id="radioButtonValidator"
source="{genderOption}"
property="selectedValue"
trigger="{groupLevel}"
listener="{groupLevel}"
required="true"
requiredFieldError="field is required"/>
<mx:StringValidator
id="checkBoxValidation"
source="qualificationGroup"
required="true"
property="selectedValue"
listener="{qualificationGroup}"
requiredFieldError="field is required"/>
</fx:Declarations>
<s:layout>
<s:HorizontalLayout/>
</s:layout>
<mx:HDividedBox width="100%" height="100%">
<s:Panel id="mainPanel" title="Employee Details" height="100%" width="50%">
<s:Form id="mainForm" height="100%" width="100%" left="10%" right="10%" top="10%">
<s:FormItem id="genderLabel" label="Gender" showErrorSkin="true" showErrorTip="false">
<s:HGroup id="groupLevel">
<s:RadioButton group="{genderOption}" label="Male" id="male" selected="false"/>
<s:RadioButton group="{genderOption}" label="Female" id="female" selected="false"/>
</s:HGroup>
</s:FormItem>
<s:FormItem id="quaLabel" label="Qualification" showErrorSkin="true" showErrorTip="false">
<s:HGroup id="qualificationGroup">
<s:CheckBox id="bsc" label="B.Sc"/>
<s:CheckBox id="be" label="BE"/>
<s:CheckBox id="mca" label="MCA"/>
<s:CheckBox id="mba" label="MBA"/>
<s:CheckBox id="others" label="Others"/>
</s:HGroup>
</s:FormItem>
</s:Form>
</s:Panel>
</mx:HDividedBox>
And I am the new one for flex. If i am using change or click event, it will display the error message via alert box. But i don't want alert box. Is any other way to display the error message is there?
When you move to the next control add and event listener to call a function to preform the validation checks.
Without more information i cant say which event listener will be applicable, but it will most likely be a click event.
<Script>
<![CDATA[
protected function validate_HDivide(event:MouseEvent):void
{
if(mycheckboxes.validate())
{
//do things
}
else
{
//display error
}
}
<s:HDividedBox id="mycheckboxes" change="validate_HDivide(event)"/>
<s:Button label="submit" click="validate_HDivide(event)"/>
then within your HDividedBox you can preform your validation
Thats how i would do it, hope this help.
I want to read a CSV file in FLex and display content of file on Datagrid. plzz provide solution...
My Datagrid and columns on which i want ot display the file file content::
<mx:AdvancedDataGrid id="dg" x="0" y="{btnBar.height}" width="100%" height="532"
defaultLeafIcon="{null}" draggableColumns="false" editable="true"
folderClosedIcon="{null}" folderOpenIcon="{null}"
horizontalScrollPolicy="auto" itemEditBegin="onItemEditBegin(event)"
itemEditEnd="processData(event)" itemOpen="onItemOpen(event.item)"
resizableColumns="false" sortableColumns="false" sortExpertMode="true"
verticalScrollPolicy="on">
<mx:AdvancedDataGridColumn id="value" width="250" dataField="value"
editorDataField="classValue" headerText="Values"
itemEditor="ComboBoxRenderer"/>
<mx:AdvancedDataGridColumn id="property" dataField="property" editable="true"
editorDataField="SelectedItem" headerText="Property"
itemEditor="PropertyComboBoxRenderer"/>
1.create a bean , parse the CSV and add it to the bean(properties same as no of coulmns).
2.add the bean to List iteratively.
3.pass the list as dataprovider to Datagrid
If there is already a post for this, I'm sorry but I could not find it.
I have the following form (sample):
<mx:Label x="105.5" y="0" text="Cadastramento Basico" fontSize="22"/>
<mx:Text x="140" y="42" text="Nome:"/>
<mx:TextInput x="176" y="40" id="nome"/>
<mx:Text x="138" y="74" text="E-mail:"/>
<mx:TextInput x="177" y="72" id="email"/>
<mx:Text x="125" y="105" text="Telefone:"/>
<mx:TextInput x="177" y="103" restrict="012456789" id="telefone"/>
And I need to read each element in ActionScript to clean up every one after a user has clicked on a submit button. In jQuery we have the function elements.each(), I just need something like this.
How can I do this please?
Please make sure you read the documentation before asking questions:
You should wrap your form into a <mx:Form> tag:
<mx:Form id="myForm" label="Cadastramento Basico">
<mx:FormItem label="Nome:" >
<<mx:TextInput id="nome"/>
</mx:FormItem>
<mx:FormItem label="E-mail:" >
<<mx:TextInput id="mail"/>
</mx:FormItem>
<mx:FormItem label="Telefone:" >
<<mx:TextInput id="telefone" restrict="012456789"/>
</mx:FormItem>
</mx:Form>
Then do it manually by running through all items of the form and check if they have the proper type and a valid property to be reset (add them to the code below if necessary).
private function clearForm():void
{
for each(var o:* in loginForm.getChildren() ){
if(o is FormItem){
var item:FormItem = o as FormItem;
for each(var o2:Object in item.getChildren()){
if(o2.hasOwnProperty("text")) {
o2.text = "";
}
}
}
}
}
I am trying to change the stage state to different state on click of a button. The problem is some times am getting exception as The supplied DisplayObject must be child of the caller.
Here is what am trying to do to change the state
this.currentState = 'fullScreen';
here this is a canvas.
Here is the MXML for the State fullscreen
<mx:State name="fullScreen">
<mx:RemoveChild target="{lstExpert}"/>
<mx:RemoveChild target="{screenToggle}"/>
<mx:AddChild relativeTo="{outContainer}" position="firstChild">
<mx:HBox id="topHeaderBox" horizontalAlign="left" verticalAlign="middle" width="98.5%" height="60"/>
</mx:AddChild>
<mx:AddChild relativeTo="{topHeaderBox}" position="firstChild" >
<mx:Label id="lblCourseName" width="100%" text="Name" color="#ffffff" fontFamily="Arial" fontSize="14" fontWeight="bold" height="20" />
</mx:AddChild>
<mx:AddChild target="{screenToggle}" relativeTo="{lblCourseName}" position="after" />
<mx:AddChild relativeTo="message" position="before">
<mx:Spacer id="Bar" height="5" width="2" />
</mx:AddChild>
</state>
What would be the mistake here?
You might want to bind the relativeTo property value of the last AddChild object. Meaning, to write it like this:
<mx:AddChild relativeTo="{message}" position="before">
Assuming you have an element with that id.
Hope this helps.
It seems like a code written right but I don't get an error message when I try to skip first name field. Instead I see a little yellow triangle with an exclamation mark in it, that appears next to the first name field. What can be a reason for this? Thanks.
<fx:Declarations>
<s:RadioButtonGroup id="phoneRadioButtonGroup"/>
<mx:StringValidator id="firstNameValidator" source="{firstNameTextInput}"
property="text" requiredFieldError="This field is required" required="true"/>
<mx:StringValidator id="lastNameValidator" source="{lastNameTextInput}"
property="text" required="false" tooShortError="Please enter at least four characters" minLength="4"/>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Form width="380" height="615" backgroundColor="#56A1B9">
<s:FormHeading label="Contact Editor"/>
<s:FormItem width="252" height="36" label="First Name" required="true">
<s:TextInput id="firstNameTextInput"/>
</s:FormItem>
<s:FormItem width="251" height="36" label="Last Name" required="false">
<s:TextInput id="lastNameTextInput"/>
</s:FormItem>
<mx:HRule width="100%" height="15"/>
<s:FormItem width="252" height="37" label="Email" required="true">
<s:TextInput id="emailTextInput"/>
</s:FormItem>
Set the required field to ..
and set the errorMessage ="required message"
This will resolve the issue