I'm developing a Word 2010 add in using Visual Studio 2010, and C#.
I've created a simple form, with two textboxes, and an Ok button.
The Ok button's Causes validation property is set to true.
Both textboxes CausesValidation property is set to false, and their Validating and Validated properties are set. This is so that they are only validated when the Ok button is clicked, and not when focus is changed.
If the form code is defined within the Word add in, the validating and validated events run as expected - when the Ok button is clicked. I wanted to make the form reusable, so I moved the form into a separate class library. The form largely works as expected but the validating and validated events never run with the above configuration.
Does anybody know why this is the case? Is it a bug?
It seems that you can get things working if you:
1) Set the AutoValidate property of the base form to Disable.
2) Set the CausesValidation property on the textbox to true.
3) Call the this.ValidateChildren() method in the button click.
Related
I have created a form using Kentico on-line form and applied the built-in "required" validation on it. Whenever a textbox is empty then a required validation is shown. Now, I have entered a value in the textbox and press tab from the keyboard but the required message does not disappear. I want to remove or hide the message from the form when the user enters a value in the text box before the submit button is clicked.
How to resolve this issue?
I don't recall this being something that Kentico handles out-of-the-box. You'll most likely need to add some custom client-side script for this. Typically - where I work, at Ridgeway - we use custom layouts for forms, as the standard layout is fairly table-rich.
I am using JDeveloper 11.1.2.3.0,
I have a createInsert button that has ShowPopUp Behavior operation included. In the popUp I have inserted a form whose attributes will be clean from the createInsert operation. When I click the button the popUp shows up all right but showing an error about the mandatory fields of the form. The fields of the form of course are empty because I just opened it. So I think that the popUp is autoSubmiting the form at the starting point.
Does anyone have an idea how to stop it from doing this?
I have changed the createInsert button PartialSubmit property to false but nothing changed.
Ok found the solution. The popUp was not submitting anything actually but during the CreateInsert operation the iterator opens a new row in every related component within that page (form, table etc). So when my popUp opened up with the new form fields, a new row was being created in the back-stage in my read-only table. I changed the iterator in a new one from another Application Module for each case and everything is fine now.
Have a custom JS function that gets called when a ribbon button is pressed in the context of a form. In my custom JS function I need to know what form field had the focus just prior to the ribbon button being pressed. I've tried 2 ways (below) without success. Is there any way to do this reliably?
Way #1
According to this, I can get the control I want passed as a parameter to my JS. I've tried using both PrimaryControlId and PrimaryControl parameters.
<JavaScriptFunction FunctionName="OnCustomBtnFunc"
Library="$webresource:myJSfile.js">
<CrmParameter Value="PrimaryControlId" />
<CrmParameter Value="PrimaryControl" />
</JavaScriptFunction>
For both, I get an object passed to OnCustomBtnFunc() but it does not seem to enable me to determine which form control had the focus prior to the ribbon button being pressed.
Way #2
I call Xrm.Page.ui.getCurrentControl(). This works for form fields of some types but not others e.g. if it is a string field it works but I get null for a lookup.
you won't like this answer, but you can use JQuery to quickly grab every Control in your Form and assign it an OnBlur event. This event can either assign the ID or the control itself to global variable, which you will make accessible to your ribbon (which fires from a different scope).
People do not like this approach because of the different context scopes of the variables and because it involves playing with "unsupported" features of plain HTML. However, if you ask only the question "how" and not "should we", then this is an easy way for "how" you would do this.
I have a User Control in VB.NET (VS 2010) inherited from a picturebox. I also have a class that holds 40 or so properties for the control. I also have a form with a property grid that is used as an editor. The editor form opens when clicking the "Custom" property of the control in the IDE. On the form are an OK and Cancel button which either saves or discards changes.
All of this works fine, but I need to have my control "refresh" when a property changes in the grid. The property grid has an event for this, but I don't know how to call or invoke my sub in the control to essentially repaint the control. If I call the sub directly nothing refreshes on the control until after I close the editor form (dialog). Is there a way to have the control repaint/redraw with the editor dialog still open?
Thanks,
EluZioN
Try using Context.Instance which is passed when your UI_Editor is invoked. In the GetEditStyle override, a Context object is passed. This holds a reference to the calling UserControl.
I do something like this (CUSTOM UI_TYPE_EDITOR):
Dim ContextOBJ as MyUserControl
Public Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext)......
contextOBJ = CType(context.Instance, MyUserControl)
In the GetEditValue override, you can call ContextOBJ.Refresh and your UserControl should immediately reflect any changes. It works for me.
I have an extension pages dialog box that I placed in a custom control. The dialog box is used to search for cost centers and return information such as market, cost center number, cost center name etc.
A "Select" button is pressed and the dialog box appears. The user searches for and selects their cost center. The OK button is pressed and it closes the dialog box and updates the various fields on the xPage.
A couple of questions.
Currently the "Select" button on the CC needs to know and refer to the name of the dialog box control within the CC. Seems to me that this is not the best practice. My end user programmer needs to know the ID of that dialog box control within the CC. Is there any way for my "Select" button could "show" the CC and the CC would actually show the dialog box control?
My CC makes use of custom properties to store the various document fields from the selected cost center. The OK button then uses these properties to set the various fields on the xPage. This again does not seem to be a best practice. If I wanted to use that CC in another application then I might need to edit the code in the OK button. Is there a better way to deal with this? Like I can set properties for a CC when I drop it on my xPage, is there a way I can tell it the code that I want to execute when the OK button is pressed?
One thing I thought was to have properties for the fields that need to be updated by the OK button but that does not seem to be so flexible.
For the issue of needing to know the id not sure if theres a typo but I don't understand why its bad that a select button inside a cc needs to no the id of the dialog to open it? did you mean the select is outside the cc? either way have you tried anything like creating a property on the custom control so that from outside it you can set something maybe
<xc:mycustomControl showDialog="false">
and then when something outside it happens change showDialog and refresh the cc, then inside the cc you can have a before / after page load to determine what happens when showDialog is true / false.
For your second issue it sounds to me like this should be using a domino document structure. Rather than the dialog pulling out each piece and the ok button updating, what I would do is have a domino doc data source on the page. when something is selected through the dialog I would update the document this source is pointing to and have all the fields bound to what ever fields they need to be. This way after something is selected the fields will just update to what ever the document contains, and it will be much more re useable so long as the domino docs have the same field names