I have two custom picklists: types and duration. The types pick list has two options and the duration has three. Based on what he picks in the types picklist, one of two variables will pass to the OOTB description text box. And based on what he picks in both of the picklists, one of six variables will pass to a custom warranty text box. Both of the text boxes are editable so he can tweak the paragraph-long variables as needed.
Problem 1: The setSubmitMode method was not present at first. When it was not present, he could not revise a quote.
Solution 1: I set the setSubmitMode to 'always' on the OnChange events.
Problem 2: When he tried to revise the quote it would throw a Read-Only error but still would allow him to revise and save the quote.
Solution 2: I set the setSubmitMode to 'dirty' on the OnChange events and added an OnSave event with a setSubmitMode to 'always'.
Problem 3: When he tries to revise the quote he gets a "Do you want to save your changes" dialog box. When he click "yes" it wipes out his changes and when he click "no" the Quote allows him to revise it... I can not produce the dialog box that a user is getting.
We've tried this in CRM for Outlook and in the browser.
If it helps to know, in both of our set-ups, it looks like it opens a new Quote window. In mine, however, the new window immediately closes without the dialog box in Outlook. But in the browser, it closes the original form too. (This isn't ideal but still is better than what he's getting.)
Thanks & Regards,
M
I'm not sure to exactly understand your issue but for those kinds of problem, I always used the same solution. On the OnSave event, i've this code to save read-only fields edited by the javascript :
if (Xrm.Page.getAttribute("my_field").getIsDirty()) {
Xrm.Page.getAttribute("my_field").setSubmitMode("always");
}
No setSubmitMode("dirty"), or anything else. Even on the onChange event.
I hope it helps, otherwise don't hesitate to add more infos about your process.
Kévin
Related
I have been looking for information about this but I don't get with the solution.
I have some text fields on a page which I get updated on blur making use of jQuery events.
There's no form to submit, the update took place in the background using jQuery $.post.
If a user updates those inputs, then clicks on a link to go to another section of the page and then comes back using the browser's back button, those inputs won't show the last values set by the user but the previous ones in case there were, or empty text inputs if there weren't.
Users are reporting this as a bug (even is more a browser behavior), and I wonder if there is any solution for this.
I have been taking a look at things like this or this, but they don't solve the problem I have. I have no forms, I have no submit and I don't want to reset the form.
I've noticed this problem doesn't take place in IE 9 and either in Firefox but it does on Chrome.
The user can navigate to different pages (more than 30) with more than 12 text fields in each and therefor I have discarded the idea of storing them on sessions.
Is there any way to solve it?
Thanks.
I do not know if my solution can solve you're problem , but:
what if you bind data to you're input? e.g you can set dinamically data on input
$('input').data( 'val' , $(this).val());
and then re-bind it through
$('input').val( $(this).data() ) ;
Do not follow exactly these lines of code , I'm trying to give you an idea of what I'm wondering. I hope that it can help you.
http://api.jquery.com/data/ doc for .data()
I'm writing a program to auto fill form blanks in the web pages. With javascript I can deal with normal blanks like username input and passwd input. But when it comes to cascade select, like some web pages asking you to input your address info, there's 3 selects: choose country, choose province and choose city. The content of the second menu is loaded upon the onchange event of the first one, so as to the third select.
I'm wondering how to auto fill these 3 selects, given that I've already known the value for each one of them. Could any one help?
The following code seems not working:
document.getElementById("selProvinces").value='11';
document.getElementById("selProvinces").onchange();
document.getElementById("selCities").value='113';
document.getElementById("selCities").onchange();
document.getElementById("selDistricts").value='1190';
You might have a few problems here.
In some browsers, calling .onchange() won't actually trigger the event. See this answer to How do I programatically force an onchange event on an input? for more details.
If the page you're filling in is ajaxing in the next lot of values in the cascade, 'selCities' might not contain the value 113 just yet. You could set a timeout and poll periodically to see if 'selCities' has some values in it before setting the value
It might not actually be the onchange event that they're using for the cascading. The oldschool way used to be onclick. They might be doing it onblur. Possibly silly, but worth peeking at the source to make sure :)
I have a column that has 2 Categories, Done and Pending. I would like to Hide/Disable edit button once the user selects an item and if that item has a Status column of "Pending".
I would like to know how can this be done, whether in visual studio 2010 or ECMA Scripts.
I know this question is old but if someone still needs the answer:
Create a custom action in visual studio like this:
https://msdn.microsoft.com/en-us/library/office/ff408060(v=office.14).aspx
This hides the button you want, now you can set a condition via enabledscript parameter to choose in which case the button should be hidden:
Just add this code after </CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="HideEditRibbon"
CommandAction="javascript:return true;" EnabledScript="javascript:checkIfNeedsToBeHidden();" />
</CommandUIHandlers>
<CustomAction Id="yourJsReference" Location="ScriptLink" ScriptSrc="yourJsFile.js"></CustomAction>
If you need this in List-Ribbon, Edit and DisplayForm, you need to make 3 Custom Actions and change the Location-Part and maybe your js-code.
If you want to use an out of the box edit form then you're not going to do this with server side code; you'd need an entirely custom edit form to do that.
This means using Javascript on the edit page, which is fragile, and doesn't prevent users from saving the data if they know what they're doing.
The input field for every column will have a 'title' attribute with the column name. JQuery can find the element with title='column name' rather easily, so that's how you'll know if you need to hide the save button. The save button isn't quite as easy to get to. You could try getting the input with type=button and value=save.
If it's important to have actual security around this, so that no matter what someone can't edit an item in this state then you can use an event receiver on the ItemUpdating event. Just check the properties of the item and use the properties.Cancel = true; (or something like that) so that even if they disable your JavaScript and save the event anyway, it won't get saved. If you need help adding an event receiver or getting it working just ask.
Edit: In your comment that you say you just want to prevent access to the edit form entirely under certain conditions. For that, I'd make a new webpart/user control and add it to the edit page. In that section you can fetch the appropriate item (the ID of the item will be a query parameter) and see if the page should be 'viewable'. If not, then you can redirect to another page.
Another addition to the above would be attempting to edit the list view such that there is no edit link for certain items. This would be substantially harder, and I doubt it would even be possible (practically) with out of the box webparts. You would need to have an entirely custom list view page in order to control which items have links to an edit page. (Others feel free to correct me here.)
I am working on a simple javascript program that searches for a wine review on one or several websites based on which sites the user is interested in.
My problem is that the window.open command only opens the first website chosen by the user and seems to be unable to open the others. Also, after scrolling through the urls of the sites listed, I get an error message saying: 405 - Method Not Allowed
You can check the program out at: http://www.divinocards.com/search_engine_4.htm
I have spent several hours trying to figure out why the program is stalling as it is. I have used the debugger and it seems that all values are being correctly assigned. It's is just that I am unable to open multiple windows. It doesn't seem to be an issue with pop-up blockers either as I temporarily disabled those.
Any help would be greatly appreciated.
Sincerely,
OB
Change the type attribute of input from submit to button (for input with name="Find" and, in fact, all inputs that you use through JavaScript exclusively, i.e. not doing a real submit to server).
More details - your form doesn't have an action attribute. Take a look here:
http://www.w3schools.com/tags/tag_input.asp
What happens in your current code when you click on "Find" button is that you are doing a submit to an unknown location. As per the standard:
http://www.w3.org/TR/html401/interact/forms.html
this attribute is required (look at section 17.3 The FORM element).
The details in the section also explain why it redirects to "nowhere":
action = uri [CT]
This attribute specifies a form processing agent. User agent behavior for a value other than an HTTP URI is undefined.
So, at the end it's up to a specific browser to decide what to do here (an implementation detail, not something you want to rely on).
If you just want to open a target window, you can remove your <form> tag , and add a click event to the find button.
Set <input> tag's type attribute to button can't prevent form submit by use press enter in the text field
You can also disable onsubmit event of the form.
like
document.forms[0].onsubmit = function(){return false;}
I have a fillable PDF form that I would like to validate before the user prints it out.
Here is my form:
http://www.pentco.com/orderforms/pentco_creditapp_v2011b.pdf
I've looked online for a simple solution and I think I've found it. It is here:
http://www.alqemy.com/Forms/RequiredFields.pdf
I've looked at its field and button properties, but for the life of me I cannot figure out how it works. There is one line of code attached to the button behaviour and that's it.
Can someone tell me what I'm missing to put the same validation function in this form into mine?
Pete
The validateFields() method (used on button's mouse up event) is defined at document level. With Acrobat select 'Edit All JavaScripts' menu item and you will see the code for this method. It can be reused very easy, you just have to set tooltips for all required fields and these tooltips must end with '*' (this is how the method determines if a field is required).
This worked perfect...thanks for pointing out where to find that JavaScript. If others are confused:
You need to be in form edit
Then you go to Advanced-->Document Processing-->Edit All Javascript...
You will find the Validation code there. You want to copy it and add it to your print button's Javascript