JuiceUI component not saving viewstate [closed] - user-interface

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
When using the DatePicker JuiceUI control the text field used to store the value does not retain its value upon postback. The DatePicker control is set as follows;
<asp:TextBox ID="txt_DueDate" Type="date" MaxLength="50" CssClass="requiredField" Width="75" runat="server" />
<Juice:Datepicker ID="dp_DueDate" TargetControlID="txt_DueDate" ButtonImage="/images/signs/ico_calendar.gif" DateFormat="dd/mm/yy" ButtonImageOnly="true" ShowOn="both" ButtonText="Select date" runat="server" />
Apart from adding the DatePicker control and the Type="date" attribute to the text box, this text box stored the value from a previous javascript only date picker and maintained it's value after postback.
Is there a attribute I am missing on either of these controls to make viewstate work again?

I tested the code you provided in a new page with a single button and the textbox retained the value set by the datepicker on postback initiated by an asp:button. There must be something else in your code resetting the value of the textbox.

Related

Why doesn't the <asp:Label> component display Hint for Style property in VS 2019?

The bounty expires tomorrow. Answers to this question are eligible for a +50 reputation bounty.
HelloCW is looking for an answer from a reputable source.
When I enter a space key in the <asp:Label ..... ></asp:Label> code , the VS 2019 will popup a window to display all properties for the <asp:Label> component , so I can select a property to custmize it, you can see Image A.
The Code A is correct, I customize the Style property, but I find all properties listed the popup window (Image A ) doesn't display the Style property, why?
Code A
<asp:Label ID="Label1" runat="server" Text="Info" Style="margin-top:10px;" ></asp:Label>
Image A

How to get the the chosen image and show it on the same page using jquery ajax [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 10 years ago.
I want to show the uploaded image on the same page without refreshing the page .
<form action='xyz.php' method='post' enctype='multipart/form-data'>
<input type='file' name='image' id='image'>
<input type='submit' name='ok' id='ok' value='upload'>
</form>
<div id='uploadedImage'></div>
<script>
$(document).ready(function(){
$('#ok').click(function (e) {
e.preventDefault();
// then should be the jquery ajax call and response ?
// help with this code .
});
});
</script>
Check out this jQuery File Upload plugin.
By standart means you can't (you can, but in two words you have to write many code with hiding inputs and showing buttons). But there are several good plugins you can use. You can check https://github.com/valums/file-uploader. It is open-code, so you can either use it or you can see how ajax upload is implemented

CKEditor: unable to cancel anchor default behaviour (href page change) after mode switch (source/wysiwyg) in FF [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
We have a CKEditor in place, on a ASP.Net MVC 3 page:
var editor = CKEDITOR.replace(...);
Inside this editor we use some plugins to create several types of elements, the element causing trouble is created with this structure:
<div backendname="asfasdf" class="editableArea" contenteditable="false" displayname="asdfasdf"
fieldheight="50" fieldlength="610" fieldtype="5" maxchars="0" required="true">
<a href="google.com">
<img align="top" alt="" hspace="0" src="http://someaddress/img.jpg"
style="border-width: 0pt; border-style: solid; margin: 0pt;
width: 420px; height: 315px;" vspace="0" />
</a>
</div>
When creating this element, we are attaching (via jQuery) the click event with a function of our own, which sums up to this:
$jq(field.$).find('a').click(function (event) {
event.preventDefault();
event.returnValue = false;
return false;
});
As you can see we've been trying some variations for the event cancelation to prevent anchor behaviour. When the element is first created this works as expected. The problem araises when we switch modes in CKEditor.
For those unfamiliar with CKEditor, when you switch modes between "source" and "wysiwyg/design" the iframe that design mode uses is destroyed and replaced with a textarea. When switching back into design, the iframe is recreated and all content populated.
We've tried to use this event on CKEditor to reattach the click event, like this:
editor.on('mode', function (e) {
if (e.data.previousMode == 'source') {
$jq("iframe").contents().find('.editableArea a').click(AnchorClick);
}
});
function AnchorClick(event) {
event.preventDefualt();
event.originalEvent.preventDefault();
event.preventPropagation();
event.returnValue = false;
return false;
} (this function was separated for debugging purposes)
Again, we tried anything we could think of, but still FF follows the link inside the iframe, which causes the lose of the CKEditor and its contents.
We cannot define href="..." in the anchor tag since the information in the CKEditor is stored for future usage, therefore we must store the true href in the link.
It's a very peculiar question, I know. The truth is I can't think of anything else to do and can't find information about how to overcome FF behaviour in this particular case. Hopefully at least one of the many users of SO has faced a similar issue and can point us in the right direction.
It was a typo. This issue is solved.
function AnchorClick(event){
event.preventDefualt();
...
}

JSF Validation Error from Component that is not Rendered

I have a form that has a field that needs to be rendered as a read-only value when in edit mode and as a drop-down select list when in create mode.
The read-only field (used in edit mode) is rendered as plain text using <h:outputText>. In create mode, the field is rendered <h:selectOneListbox> that has a required attribute of "true".
It seems to work as I expect most of the time, but occasionally I get a validation error when in edit mode (the select list box is not rendered) .
Here is the code snippet that has both fields defined with their rendered attributes set using the same boolean value (just one field negates the boolean to toggle).
<h:outputLabel id="lblBusinessArea" value="Business Area:" />
<h:panelGroup id="baGroup">
<h:selectOneListbox id="businessAreaList" size="1"
rendered="#{shiftDetailsController.canEditBusinessArea}"
converter="businessAreaConverter"
value="#{shiftDetailsController.selectedBusinessArea}"
label="Business Area"
required="true">
<f:selectItems id="businessAreaListItems" value="#{shiftDetailsController.businessAreas}" />
<a4j:support id="businessAreaA4j" event="onchange"
ajaxSingle="true" reRender="deploymentGroupList, positionPayGroupList, sapPremCodeList" />
</h:selectOneListbox>
<h:outputText id="businessAreaRO"
rendered="#{!shiftDetailsController.canEditBusinessArea}"
value="#{shiftDetailsController.selectedBusinessArea.busAreaDesc}" />
</h:panelGroup>
Below is a screen clipping showing the field (in edit mode) rendered as read only. The "save" button was clicked and I get a validation error message that the field is required.
The value should be there in the backing bean because the value displayed is from the same object (shiftDetailsController.selectedBusinessArea). The output text uses the description field on the business area ojbect and the select field uses the whole object where the SelectItem has the description in the label.
Any idea how this could be occurring? I could set the required attribute using the same boolean value that determines the rendered state...so that it is only required when it is rendered...but since this problem is intermittent...I don't know that will really help.
I also verified that no other components on the page inadvertently have a label value of "Business Area" (which is being used in the validation message) to mislead me in which component truly has a null value; this is the only one that has the label of "Business Area".
I figured out what was happening with this issue.
Prior to submitting the form and receiving the validation error. I was making a change that caused the flag controlling the two components' visibility to be reversed.
rendered="#{shiftDetailsController.canEditBusinessArea}"
In other words, what I was doing on the form was causing the canEditBusinessArea to change values. But, I was not re-rendering the panel group ("baGroup") to cause the UI to reflect the update.
Thus, when my form was submitted the component during the validation phase was seen as being required...triggering the validation to happen. As soon as I added "baGroup" to the reRender of the action that was flipping the edit business area flag, the UI began reflecting the update and the submitted form had the value.

XUL Toolbar is not in FF toolbar list [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 9 years ago.
Ive got a following problem.
I made a XUL toolbar. Toolbar works correctly, it is displayed correctly and works fine. The only problem is that it is not displayed in the list of toolbars in Firefox. I want it to be in this list - i want to be able to hide/show it from context menu.
What my problem could be in? XUL is organized in following way:
<?xml version="1.0" encoding="windows-1251"?>
<overlay id="myOverlayName"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript" src="json.js"></script>
<script type="application/x-javascript" src="md5.js"></script>
<script type="application/x-javascript" src="sd.js"></script>
<toolbox id="navigator-toolbox">
<toolbar id="somebarid" mode="full"
customizable="false"
toolbarName="toolbarname"
accessibleType="1020"
context="toolbar-context-menu" >
...
...
</toolbar>
</toolbox>
</overlay>
toolbarName="toolbarname" should :
1) be spelled toolbarname
and
2) exactly match <em:name>toolbarname</em:name> string in RDF.
After that it works well.

Resources