How can i try to view html character & in my jsp textbox editDescription field and i don't want to show & .
Here is my code >>>
function Edit(click)
{
var description= tablerow.cells[5].innerHTML;
document.getElementById("editDescription").value = description;
}
When i click the Edit button on the datatable, the Edit pop up will appear and binding the value like this.
one month & half day instead of one month & half day.
now i am ok with JavaScript replace method .
{document.getElementById("editDescription").value = description.replace(/&/g, '&'); }
Related
In Microsoft access I want to be able to change the caption of a label after pressing a certain button on my form in Microsoft Access. I have tried the VBA code as shown below but it does not work and the caption stays the same.
How do I fix this ?
The field from the table is an integer called "Sem1-Credits" and the contents of this field according to the relevant programmeID is what I want the label caption to be changed to.
For example the ProgrammeID of "AM" has the Sem1-Credits of "30" in the table
The Table is called "Programme"
The unique identifier of that table is "ProgrammeID"
The name of the button is AMButton
Forms!StudentOptionForm!S1CreditsL.Caption = DLookup("[Sem1-Credits]", "Programme", "[ProgrammeID]= '" & AMButton & "'")
Thanks
You ProgrammedID could (and should) be a Long. If so, no quotes:
Forms!StudentOptionForm!S1CreditsL.Caption = DLookup("[Sem1-Credits]", "Programme", "[ProgrammeID] = " & AMButton & "")
And bevare that DLookup will return Null for no results which Caption doesn't accept, thus wrap in Nz:
Forms!StudentOptionForm!S1CreditsL.Caption = Nz(DLookup("[Sem1-Credits]", "Programme", "[ProgrammeID] = " & AMButton & ""))
i Placed this code in my report property code
Public Function PageNumber() as String
Dim str as String
str = Me.Report.Globals!PageNumber.ToString()
Return str
End Function
and called in my text box in body of report Like this
=Code.PageNumber()
It was not able to repeat textbox on each page.
It is showing the page number as 1 only on first page.
need to show pagenumber in each page of the output in body of the report
Kindly help me on this if u have any solution.
First Follow the steps 1 below to do pagination:
1)
1.1. Click the Details group in the Row Groups pane.
1.2. From the Tablix member Properties pane, expand “Group”-> “PageBreak”.
1.3. Set the “BreakLocation” to “End” and set the “Disable” property to the expression like below:
=IIF(rownumber(nothing) mod 40=0,false,true)
The above point 1 is use to do pagination in Report output(Display only 40 records per page in output)
2) use custom code:
Public Function PageNumberno(val as integer) as String
Dim str as String
str =(val/40)
Return str
End Function
3) Create Calculated column in Dataset and enter =0 in expression
4) In 2 Calculated Column
1)Pageno
2)No in Dataset
In Report Body use Expression for PageNo :
=code.PageNumberno(Rownumber("DataSet1"))
use Expression for No :
=IIF(Instr(code.PageNumberno(Rownumber("DataSet1"))
,".")<>0,
(Left(code.PageNumberno(Rownumber("DataSet1")),
(Instr(code.PageNumberno(Rownumber("DataSet1")),".")-1))+1)
,code.PageNumberno(Rownumber("DataSet1"))
)
5)Right click and insert column on Right Side and in Column name add code in Text box
=ReportItems!No.Value
Note: No is calculated Field column name.
6)Under AdvancedMode
IN Row Group select Static and Set RepeatOnNewPage Properties to True
In the Above Column created under point 5 will display correct page no in every page in body of the report
I have Tried and its working Fine..Try it.
I usually put a text box in the footer of the report (which will automatically display on every page) with the following line of code in it (no report property code needed):
="Page " & CStr(Globals!PageNumber) & " of " & CStr(Globals!TotalPages)
I have a field called icon, which is a droplist sourced from folder in the content tree. I would like the list to not just show the text value(shown in the screen shot) but also to utilize an icon font and display what the actual icon would look like. Basically customizing the content editor's droplist for this field from:
<option value="gears">gears</option>
to
<option value="gears">gears <span class="my-icon-font-gears"></span></option>
Is there any documentation on how to modify the outputted html for a droplist, and to modify the content editor page to load another link, in this case a font-file.
I created a module on the marketplace that does something similar. You can have a look here. There is some documentation on there explaining how to use it.
The code is also on Git if you want to have a look.
Suggest you use the Droplink field type instead of the Droplist, since the value is stored by GUID and this will lead to less longer term problems if the link item is renamed or moved. In any case you need a custom field, inherit from Sitecore.Shell.Applications.ContentEditor.LookupEx (which is the DropLink field type) and override the DoRender() method with the custom markup you require.
It's not possible to embed a span tag since the option tag cannot contain other tags as it is invalid HTML. Adding it will cause the browser to strip it out. You can however set the class on the option itself and style that.
`<option value="gears" style="my-icon-font-gears">gears</option>`
Here is some sample code to achieve the field.
using System;
using System.Web.UI;
using Sitecore;
using Sitecore.Data.Items;
using Sitecore.Diagnostics;
using Sitecore.Globalization;
namespace MyProject.CMS.Custom.Controls
{
public class StyledLookupEx : Sitecore.Shell.Applications.ContentEditor.LookupEx
{
private string _styleClassField;
private string StyleClassField
{
get
{
if (String.IsNullOrEmpty(_styleClassField))
_styleClassField = StringUtil.ExtractParameter("StyleClassField", this.Source).Trim();
return _styleClassField;
}
}
// This method is copied pasted from the base class apart from thhe single lined marked below
protected override void DoRender(HtmlTextWriter output)
{
Assert.ArgumentNotNull(output, "output");
Item[] items = this.GetItems(Sitecore.Context.ContentDatabase.GetItem(this.ItemID, Language.Parse(this.ItemLanguage)));
output.Write("<select" + this.GetControlAttributes() + ">");
output.Write("<option value=\"\"></option>");
bool flag1 = false;
foreach (Item obj in items)
{
string itemHeader = this.GetItemHeader(obj);
bool flag2 = this.IsSelected(obj);
if (flag2)
flag1 = true;
/* Option markup modified with class added */
output.Write("<option value=\"" + this.GetItemValue(obj) + "\"" + (flag2 ? " selected=\"selected\"" : string.Empty) + " class=\"" + obj[StyleClassField] + "\" >" + itemHeader + "</option>");
}
bool flag3 = !string.IsNullOrEmpty(this.Value) && !flag1;
if (flag3)
{
output.Write("<optgroup label=\"" + Translate.Text("Value not in the selection list.") + "\">");
output.Write("<option value=\"" + this.Value + "\" selected=\"selected\">" + this.Value + "</option>");
output.Write("</optgroup>");
}
output.Write("</select>");
if (!flag3)
return;
output.Write("<div style=\"color:#999999;padding:2px 0px 0px 0px\">{0}</div>", Translate.Text("The field contains a value that is not in the selection list."));
}
}
}
This field adds a custom properties to allow you to specify the linked field to use for the style class. The assumption is that you have another single line text field on the linked item to specify the CSS class.
Usage: Set the source property of the field in the following format:
Datasource={path-or-guid-to-options}&StyleClassField={fieldname}
e.g. Datasource=/sitecore/content/lookup/iconfonts&StyleClassField=IconClassName
To use this new field compile the above code in to project, switch over to the core database and then create a new field type – you can duplicate the existing Droplink field located in /sitecore/system/Field types/Link Types/Droplink. Delete the existing Control field and instead set the ASSEMBLY and CLASS fields to point to your implementation.
You also need to load a custom CSS stylesheet with the style defintions into the Content Editor, which you can achieve that by following this blog post.
I'm trying to find a way to do the following:
I want to have two different formats for a certain text box. To do so, I've done the following: User types one or two digits in a form text box(who's input and format are both "#,0;0;_") and has "yes/no" box on the right of that number field which asks if it's "kg per bag"(so by default it's the other measurement unit which is Percentages), then an OnLoad event is fired when viewing the report for that form, which checks if the yes/no value is yes or no. If "yes" then the format is set to "#.0 & " kg/bag"", if no it's set to "#.0 & " %"".
I will have to additionally divide by 100 when percentages are the ones picked, but first I want the whole thing to work... Which I still can't do!
Sadly, I'm nowhere near getting it to work... Here is my current macro on the onload event of the report, which is marked as not valid expression:
Link to the image on Imgur
Or here is the MacroBuilder Code:
<?xml version="1.0" encoding="UTF-16" standalone="no"?>
<UserInterfaceMacros xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><UserInterfaceMacro For="Report" Event="OnLoad"><Statements><ConditionalBlock><If><Condition>[yn]=False</Condition><Statements><Action Name="SetValue"><Argument Name="Item">[Text0].[Format]</Argument><Argument Name="Expression">#,0 & " kg/bag"</Argument></Action></Statements></If><Else><Statements><Action Name="SetValue"><Argument Name="Item">[Text0].[Format]</Argument><Argument Name="Expression">#,0 & " %"</Argument></Action></Statements></Else></ConditionalBlock></Statements></UserInterfaceMacro></UserInterfaceMacros>
Which is displayed as:
If [yn]=False Then
SetValue
Item = [text0].[format]
Expression = #,0 & " kg/bag"
Else
SetValue
Item = [text0].[format]
Expression = #,0 & " %"
End if
Can anyone give me a hint on where to go with this? Thank you!!
P.S. Comma is my decimal separator in regional settings!
You don't really need to change format only concatenate the numeric value with unit (kg/bag or %).
Using VBA, try the following code in the OnLoad event (I am assuming the recordsource field behind the text0 control is called the same -text0):
If Forms!yourformname![yn] = False Then
Reports!yourreportname!text0 = Me.text0 & " kg/bag"
Else
Reports!yourreportname!text0 = (Me.text0)/100 & "%"
' ALTERNATIVELY: Reports!yourreportname!text0.Format = "percent"
End If
Alternatively in the OnLoad event, use an embedded macro or call an external macro with the following one action (if/then changed into the IIF function):
SetValue
Item: text0
Expression: =IIF(Forms!yourformname![yn] = False, text0 & " kg/bag", text0/100 & "%")
I'm trying to add value to the current value of an input text field in AS3.
EXAMPLE: I have a few buttons and each button has a value, when i click on each button, the value of that button gets copied/inserted into a text input field on the stage.
further explanation:
button 1 value is (BALL)
button 2 value is (Book)
button 3 value is (Pen)
button 4 value is (cup)
etc etc ....
I have an empty input field on the stage called rest_Text.text.
so when I click on any of the buttons above, the value of that button gets copied inot the rest_Text.text...
and the final result would be something like this in the rest_Text.text:
BALL, Book, Pen
my current code is this:
function clipClick(e:Event):void {
MovieClip(root).main.loginHolder.rest_Text.text = e.target.clickTitle;
}
the code above will delete the current value and replaces it with a new one! but i need to add each value to the current one without deleting the old value.
any help would be appreciated.
Thanks in advance.
You can concatenate strings using the addition operator (+). For example:
trace(btn1.clickTitle + btn2.clickTitle + btn3.clickTitle);
//traces "BALLBookPen"
Adding on to an existing string is done with addition assignment (+=). Since you want a comma and space between each string, this is how you'd rewrite your function:
function clipClick(e:Event):void {
MovieClip(root).main.loginHolder.rest_Text.text += ", " + e.target.clickTitle;
}