How to validate Acrobat fields before page is closed - validation

I need to ensure that 2 fields in my pdf are consistent. They get filled in at different times, so I can't use field validation. I need to validate them before the page is closed.
I tried the page/close event but it's too late because the page closes without looking at the rc.

You might use both, the Leave Page event, as well as the Document Will Close event. In both cases, you will have to manually evaluate the field's values, and go back to the page itself.

Related

Composite Fields In MSCRM 2013

I have a question on the subject of composite attributes that I would be grateful if you could help me with.
I posted this before on other question blogs but got no response I am satisfied with.
I am writing JavaScript that will update the fields (i.e. address1_line1, address1_line2, address1_line3, address1_city, address1_stateorprovince, address1_postalcode, address1_country) in the composite (address1_composite). When the fields are updated the composite does not seem to update. I have to open the composite and close it again. Is there a way of doing this automatically in JavaScript?
I have tried the following ideas:
Idea 1:
Xrm.Page.data.entity.save();
This is recomended at http://community.dynamics.com/crm/b/magnetismsolutionscrmblog/archive/2013/10/22/working-with-dynamics-crm-2013-composite-fields-fly-out-menu.aspx
This is not any good as my customers want to view the composite before saving the page. Also I would not want to save the page for my customers as they do not want this. They would like to decide when to do this themselves.
Idea 2:
Xrm.Page.data.refresh();
This is not really what I wanted as I do not want to refresh the whole page. I just want to refresh the composite. Also it bring up a popup that warns you about not having saved the page which will be annoying for my customers.
Idea 3:
Writing the address from the address lines to the composite.
This feels like a nasty hack.
There is probably more than one way of doing this. I used the function
Xrm.Page.getAttribute("address1_composite")._attribute.setValueForCompositeField();
I do not like this for the following reasons:
This is a hack as it is not using the system functionality of the done button to write the data.
You do not get the system formatting you get with the done button although this will get done when the form is saved so it is not so bad.
In the future if customers are allowed to add their own composite fields it could cause problems as the field names could be different.
It requires me to write extra code for each form that has a composite which has fields with different schema names. E.g. I have to write different code for forms with ShipTo and BillTo addresses as the code for the account form will not work.
Another idea was to set the focus to the composite field after a change has been made to any of the fields inside the composite.
Xrm.Page.data.entity.attributes.get("address1_composite").controls.get(0).setFocus();
This is the best idea so for but it is far from perfect. This forces the user to press the done button and hence the fields will be written. I was hoping for something more automated.
My Question:
What would be great is if there was a way to click the composite done button in JavaScript. This would give me the formatting of the done button and the automation I need.
Update - 14/04/2014
Since posting this question I have been in contact with Microsoft and they say there is no supported way of clicking the done button via a program.
If the field is locked down CRM JavaScript does not send the data back to the server for updating. Another approach would be:
perform the update using JavaScript (so the user sees the change); and
use a server side plugin on the Update event so the value is persisted.

After a form is filled once, I blank out the form before filling it the next time (new conversation), but the borders remain red

I have used webshims for html5 form validation in a single page app with multiple pagelets(divs). The forms are not submitted but local javascript is invoked after each conversation and collected data is posted .
Next I iterate over all the fields and reset the values.
Then I take the new user back to the first pagelet having first form for the new conversation. This time even after filling the correct values the border does not turn green.
Note:
However when we select the field and click outside the field without filling it. and then after filling the correct data border turns green.
However when we tried to achieve it programmatically iterating over each field resetting it and using javascript focus method, that did not do the trick.
I am sure I must be missing some thing. would be able to point out what.
Regards
Barman
I'm not sure, what you want to achieve. I would need to see some code. If you change the value programmatically you can update the validation ui with the event refreshvalidityui on the form field. If you want to reset the ui, you can either trigger a reset event on the form or resetvalidityui on the form field
$('input').val('foo').trigger('refreshvalidityui');
or
$('input').val('foo').trigger('resetvalidityui');
or
$('form').trigger('reset');
Please let me know, if this helps.

ajax button in cakephp 1.2

I'm trying to make something like this:
an html form with 5 button (each one with a differn value). if you click one of this button will be dispayed an text input (with a default value depending to the clicked button value, so the buttons call an ajax/javscript function to generate the default value) and a submit button.
I'm unable to create this type of form. have any suggestion for me ? Thx in advance.
I wouldn't use CakePHP's AJAX features, just write it yourself. Cake's features are useful in limited situations (e.g. pagination) but as soon as you need flexibility, it becomes a limiting factor. I believe the JsHelper is actually being removed in future versions.
To get this done without Cake, take a look at http://jsfiddle.net/mjxWg/8/. It's not a complete working example (e.g. there is no <form> tag), but it should show you enough to get started on your own.

AjaxFormValidatingBehavior Performance and Lost focus on Firefox

My project is using Wicket's AjaxFormValidatingBehavior to auto-save form content to Session on sort of a multi-tab form with a tree menu (there is no save button on individual tabs, though there is a "Save" button that actually submits the form, runs the validations and saves contents to database). I am facing few issues:
Since the behavior is added to all form components' onChange event, there is a server-trip every time user moves from one field to another. I know that a throttle duration can be specified to prevent this, but its not possible to set in my case as my forms are of different lengths/complexity, many components dynamically generated (including the tree menu). But is there a more elegant solution to auto-save form content (that doesn't have a submit button) rather than this annoying solution.
Another issue I am facing is that post onChange event, on Firefox the component loses its focus after the "server trip" ends. While on IE7 it works fine.
For the first question I think you need to add a pipelining facility, on your components' onchange call a javascript function of your which calls your webapp. You can include a feature similar to the one provided with the throttle duration but page-wide (delay each calls and only trigger the last if it is older than x milliseconds for example).
For the second one, I think you have to use the AjaxRequestTarget#focusComponent in your behaviors, or handle this thing in your "wrapper" as described in the first answer.

AJAX and prediction of actions

I'd like to ask your opinion on this. This is a theoretical question.
I'm in a situation where I have an interface shown to a user that uses AJAX to talk to the server. The server-side language does not matter here. I have a form with fields and each of them are deletable. If the user selects a few "delete" -checkboxes and presses Update, then I have these two options to do:
Option 1:
When deleting fields, use JavaScript to remove the HTML immediately and run AJAX on background to delete those fields. This achieves a look of a fast interface -> better user experience. However, if the AJAX call fails on the server side (the fields couldn't be deleted), then the previously deleted HTML fields would give a false assumption for the user (of them being deleted).
Option 2:
When deleting fields, run AJAX, depending on its success, either remove the HTML or do not. This gives accurate feedback for the user, but the form would freeze until the AJAX call finishes = slow(er).
What are your thoughts? Which approach seems better for me to take or should I make it an option?
Option 3: Mark the controls as being deleted (e.g. overlay a translucent gray box with a delete icon on it). Send the request. When it returns, either remove the controls, or change the box to show an error icon for a few seconds (then remove the box).
Allow the rest of the interface to be interacted with while this goes on.
Nice question.
A third option would be to :
disable immediately the controls
delete them when the Ajax returns
This gives the user feedback that something was effectively requested (responsiveness),
while showing also the moment where it is effectively completed.
Also, the user somehow feels the "distant call", which does not induce him in error, because it is was really happens. Anyway, there is nothing meaningful we can do to hide this feeling, because the delay will always be there.

Resources