Text not showing in Flex Spark.TextArea when added dynamically - actionscript-3

I'm writing a veeeeeeeery simple code where a Spark TextArea is in a TabNavigator and I want to write something into it dynamically. The problem is: when I try to do it the TextArea stays white until clicking on it makes the text appear magically.
The mxml is this:
http://pastebin.com/7WqvXuH2
and very simple code to write is this:
xmlError.text += error+"\n\n";
I also tried this but with the same result
xmlError.appendText(error+"\n\n");
Hope I've been clear.

As a work-around I've used the code below, there are multiple input fields on this view setting the focus on just one of the text inputs causes all of them to render the text correctly.
The only really relevant "property" is the creationComplete handler.
<s:TextInput autoCapitalize="none"
autoCorrect="false"
creationComplete="{tiFirst.setFocus()}"
id="tiFirst"
prompt="{data.firstName}"
text="{data.firstName}"
width="300"
tabIndex="0"/>

Related

Trying to set a html property based on a code behind value

I'm trying the following:
<div id='divOwner' runat=server visible='<%# isAccountOwner(Me.UserId) %>'>
I would expect this to switch visible / invisible based on the value of isAccountOwner. This is not working as expected, and is always coming up visible. Can somebody enlighten me please?
Thanks
#in code nuggets (<% %>) is used with data bound controls like gridview, repeater control etc. For your div to work like this you need to call the DataBind method of this Div or one of its paremt control.
So, In page load include this line:-
divOwner.DataBind();
And make sure isAccountOwner returns a Boolean.

Change text align and direction of RadHtmlChart data

I have a chart:
<telerik:RadHtmlChart ID="chrtInvestmentAmount" runat="server" Transitions="true" DataSourceID="SqlDataSource1" Height="256px" Skin="Glow" Width="1024px" RenderMode="Auto">
<PlotArea>
<Series>
<telerik:ColumnSeries DataFieldY="InvestmentsAmount" Name="כמות משקיעים"/>
</Series>
<XAxis DataLabelsField="Month">
<TitleAppearance Text="חודש" />
</XAxis>
<YAxis>
<TitleAppearance Text="כמות משקיעים" />
</YAxis>
</PlotArea>
</telerik:RadHtmlChart>
Now in my body tag I have set the direction of the page to rtl, and when i do that the whole chart gets messed up, the text gets cut off a little and all in all it just doesent look good:
for some reason it just gets all messed up. Isn't there some small piece of code which can fix this?
And while im asking, another problem i have is after setting the chart type (bars,lines and so on...) it does not update it and i also notice no line of code is added to the HTML. I dont know if something needs to be added, either way i cant change the chart type. Is there some kind of code which can change the chart type?
Thanks.
RadHtmlChart renders with markup (SVG or VML) so some CSS properties can affect it and break it. To avoid such issues you can have them reset for the charts. For example:
<telerik:RadHtmlChart CssClass="resetChart" ID="chrtInvestmentAmount" runat="server" Transitions="true" DataSourceID="SqlDataSource1" Height="256px" Skin="Glow" Width="1024px" RenderMode="Auto" >
and something like this in the CSS:
.resetChart
{
direction: ltr;
float: none;
text-align: left;
}
as for the chart type - this depends on the type of series you add to the chart. In your case you ahve a ColumnSeries, to add a different type of chart you need a different type of series. This does not happen with just a click on the design time wizard, its first page only preselects the types of charts you can add in the other tabs like the Series tab: http://www.telerik.com/help/aspnet-ajax/htmlchart-design-time-using-visual-designer.html.
A simple solution to my question was just putting the charts in a table, and not touching anything with the css and the problem was solved.

Dynamically add textbox in HTML Page through Angular JS

I want dynamically add text-box in html page when user is press a button. and after that i want to get the respective field value or all field value.
I tried doing ng-repeat but it will not work. can anyone tell me how i will achieve this.
I would indeed use ng-repeat, and just push a new object onto the array. Maybe something like this?
<button ng-click="textFields.push("")">Add</button>
<textarea ng-repeat="val in textFields" ng-model="val"></textarea>
Well there are a few things you could try. One of them is loading a hidden div when clicked on the button. The hidden div contains the text box.
Like this :
$(document).ready(function(){
$("#hiddendiv").hide();
$("#button").click(function(){
$("#zmedia").show();
}};
And in your html form you just add a div that contains a textbox and the id of the dive should be "hiddendiv". The downside is that once the hidden div is loaded, it cant be removed. There are other scripts that are a lot more sophisticated, check these links out:
https://github.com/wam/jquery-addable
http://www.randomsnippets.com/2008/02/21/how-to-dynamically-add-form-elements-via-javascript/

Flash Builder 4.7 I want the spark TextInput to have an background text like Username. Is there anything ready?

I would like my spark TextInput to have a background text. It just sounds like something that should be easily in the component and so I wouldn't want to program it in an ugly way. Something like, when the component is not focused it shows Username with different letter style like Italic for example. So when you press on the textInput it disappears and will only show again if there is no text. It sounds like something that I could easily code. But there must be something done for it already.
Thanks,
David
Just use promt property:
<s:TextInput prompt="Not Focused Empy text" text="Other text" />
See more here: http://help.adobe.com/en_US/flex/using/WS19f279b149e7481c-177b1c712d80a315e7-8000.html

HTML Submit-button: Different value / button-text?

I'd like to create an HTML form submit button with the value 'add tag', however, the web page is in Swedish, so I'd like to have a different button text.
That is, I want to have a button like
but I want to have my code like
if (request.getParameter(cmd).equals("add tag"))
tags.addTag( /*...*/ );
Is this possible? If so, how?
It's possible using the button element.
<button name="name" value="value" type="submit">Sök</button>
From the W3C page on button:
Buttons created with the BUTTON element function just like buttons created with the INPUT element, but they offer richer rendering possibilities: the BUTTON element may have content.
Following the #greg0ire suggestion in comments:
<input type="submit" name="add_tag" value="Lägg till tag" />
In your server side, you'll do something like:
if (request.getParameter("add_tag") != null)
tags.addTag( /*...*/ );
(Since I don't know that language (java?), there may be syntax errors.)
I would prefer the <button> solution, but it doesn't work as expected on IE < 9.
There are plenty of answers here explaining what you could do (I use the different field name one) but the simple (and as-yet unstated) answer to your question is 'no' - you can't have a different text and value using just HTML.
I don't know if I got you right, but, as I understand, you could use an additional hidden field with the value "add tag" and let the button have the desired text.
If you handle "adding tag" via JScript:
<form ...>
<button onclick="...">any text you want</button>
</form>
Or above if handle via page reload