symfony form label from required widget with stars - forms

I'm searching the best way to output a label of a widget with a star (*) if this widget is required. It should be automatic.
I didn't find any way to do it :(

One way to do this is to use a custom form formatter.

You could always look at setLabel in the form clas:
$this->widgetSchema->setLabel('YOUR_WIDGET', 'NAME <em>*</em>');
This will show the widget: NAME * which you can then style in CSS

With Symfony2 I'm going to use this simple CSS trick
.required:after {
content: "*";
}
Found here

Related

Flutter-Conditional formatting based on unique characters within a string. Is it possible?

I am new to flutter and have an application that uses a realtime database composed of long text strings. I am unable to separate the string itself into different sections and am wondering if it would be possible to apply conditional formatting with RichText(). I have seen that package of easy_rich_text and wanted to do something similar, but don't see an option to modify the string after the target text has been identified.
For example, if I had a string with "Apples are /red/ fruit", I could have flutter detect the string within the // and have font color red, while the remainder is black. Is this possible? And if so, How should I go about writing code for this?
Thanks in advance
Using the package flutter_html is probably the easiest way:
Widget widget = Html(data: 'Apples are <span style="color: #ff0000">red</span> fruits');
https://api.flutter.dev/flutter/widgets/RichText-class.html
Try this. It sounds like it should do the trick.
To be clear you need to parse the string yourself and thei render the results into the widget.

DateBox/datepicker in smartGwt

I want to add a datebox similar to the one in give link
http://www.jeasyui.com/demo/main/index.php?plugin=DateBox&theme=default&dir=ltr&pitem=
in my web aplication project(smartgwt).
In short I want the datebox(jquery) equivalent in smartGwt.
when i googled i found out there is something called dateChooser in smartGwt but it works like a calendar i want something like the one in above link textfield with a button which on clicking displays the calendar and the selected date appears on the textbox.
please give any suggestions i am using smartGwt LGPL.
You can use a DateItem with useTextField=true to get the required behavior.
DateItem dateItem2 = new DateItem();
dateItem2.setTitle("Date");
dateItem2.setUseTextField(true);
dateItem2.setHint("<nobr>Direct date input</nobr>");
Check 'Date Controls' section in http://www.smartclient.com/smartgwt/showcase/#form_controls_various.
DateItem is a FormItem, meaning you need to put it in a form, and will work just like other form controls.
DateChooser on the other hand is a standalone widget that you can embed among other widgets on its own.
I haven't seen such a component in smartgwt showcase but there is something called PickerIcon which can be coupled to a TextItem to achieve what you want.
PickerIcon datePicker = new PickerIcon(PickerIcon.DATE, new FormItemClickHandler() {
public void onFormItemClick(FormItemIconClickEvent event) {
SC.say("Date Picker clicked"); // or show a dateChooser component
}
});
TextItem datePickerControl = new TextItem("datePicker", "Date Picker");
datePickerControl.setIcons(datePicker);
http://www.smartclient.com/smartgwt/showcase/#form_category_picker_icons
Hope this can help !

dojox.grid.DataGrid hide/disable the header of the grid

I need a option to hide the header from a dojox.grid.DataGrid grid.
Didn't find anything.
I'm grateful for any info!
I use in dojo 1.6 (and probably works since dojo 1.3)
#myGrid .dojoxGridHeader { display:none; }
You can use CSS:
.dojoxGrid-header { display:none; }
This solution is taken from:
http://dojotoolkit.org/reference-guide/dojox/grid/DataGrid.html#hiding-the-headers-of-a-grid
u can connect at the postrender of the data grid. then find the headerGrid element created
then put style display to none.
//workaround the grid calls postrender after
//the component is at the dom.
//so then i can change the style to reset the header to invisible
dojo.connect(grid,"postrender",function(){
var headerGrid =this.domNode.firstElementChild;
headerGrid.style.display="none";
});
I would recommend switching to using the new and improved dgrid instead of datagrid, it is a lot better!
The setting for hiding headers is the attribute 'showHeader' which is a boolean value.
Check out this dgrid tutorial that talks you through defining grid structures including 'showHeader'.

zend form - Element Label in two line

I am extremely new to Zend Framework, In registration form, i need label text in two line. For Example:- In the case First name, I need to display like below:
First
Name:
How can i implement this? Please anyone help me!!!
By default, input fields labels are being escaped by Zend_View_Helper_FormLabel. However, you can easy switch this off:
$yourTextInputElement->getDecorator('label')->setOption('escape', false);
This way you can use labels as e.g. $yourTextInputElement->setLabel('First <br/> name');.
What about this nifty solution ?
http://jsfiddle.net/J67GD/
The best way is probably to use Description decorator, or subclass one of other standard ZF decorators.
Yanick's CSS solution might be a good choice too, depending what are you trying to do.

How can I format text in GWT label widget

I would like to break a long line of text assigned to the standard Label widget in GWT.
I was experimenting with inline <br /> elements but with no success.
Something like this:
label = "My very very very long<br />long long text"
You need to use the HTML widget, which extends the standard Label widget, and adds support for interpreting HTML tags.
See the JavaDoc.
I would use CSS to style the label to fit a given with and drop the <br/> all together.