InfoPath conditional rules - infopath

Is there a way in InfoPath 2010 to require certain fields based on the action performed? I have a request approval view which essentially just contains all of the content of the original request form in read-only format, and the reviewer can approve the request, reject the request with feedback, or request ad-hoc review. If the reviewer chooses the 'reject' action, they should be required to provide feedback (but only if they choose this option). If the reviewer chooses to request an ad-hoc review, they should be required to choose a person from some sort of person picker.
TL;DR - I need to require certain fields based on the action the user chooses.

Use a custom button to submit the form and run set of rules when the button is clicked, i.e. a validate rule and a submit rule. Set the validate rule to run if Field1 is "foo" and Field2 is empty. The action is to set a trigger field that shows/hides a section with an error message. Stop rule execution after the validate rule, so the form won't be submitted.

Related

Display user ID in the metrics of application Insight

This page
http://azure.microsoft.com/en-us/documentation/articles/app-insights-web-track-usage-custom-events-metrics/#authenticated-users
Show how to have login information in the section "Authenticated users".
But how can I see this information in Application Insight after that
I do not see user anywhere in the custom event properties for events, it seems to be the internal field that's collected but not directly exposed in the view because most of the time this "auto-collected" user would be simply an auto-generated GUID....
You can take a look at the users summary on "Usage Analytics/Users" view as well as in Metric Explorer (just select the metrics about app users like "user accounts"...)
You should be able to search for user in the Diagnostic Search but only if you specify the user name you are looking for in the search - you'll get events/traces and so on for that particular user.
Also, you can try to submit authenticated user as a custom property on the event instead of (in addition to) the embedded property, in this case you should definitely see if as part of the properties in UI but this leads to a duplication of the value inside the event (internal + custom)...
You can make a query with Analytics. The result of your query should return a column called user_AuthenticatedId.

Drupal Entity Registration module - List of deleted registrations

I have events (sport trainings), created manually. Users can register for that events with Entity Registration module.
What I need is a list of deleted registrations. I can create a rule "after deleting a registration create a new entity" with a date field (when registration was deleted) and a field contains user. But problem is... I don't know, how to store name of that related event.
Is there a way to store a name or date of related event, when registration was deleted? How can I do it?
It has been a while since I have messed with entity registration, but if I am not mistaken, isn't there a registration state option?
This may be a bit of a workaround, but could you disable the ability for users to delete a registration outright, but allow them to change the state of their registration to a state called "Deleted"? That way you would still have the registration and still have all of the data associated with it.
For a more streamlined method, you could add a button or something that runs an action that changes that user's registration to state "Deleted" but no button to change it back, so they cannot un-delete (assuming you don't want them to be able to un-delete).

Can an asp:Button with Visible=False be submitted by a malicious user?

Such a button is not rendered to the browser, so is there any way a malicious user would be able to trigger the action defined by the invisible button? e.g. with a JavaScript call to WebForm_DoPostBackWithOptions? Would ASP.NET accept a POST that appeared to be triggered by this button, even though it wasn't rendered?
Short answer yes.
It is always up to you (the developer) to ensure data received from user input (in this case a post) is valid. Having said that the asp.net framework will do a lot of verification for you, such as "suspicious looking post values".
It is possible to construct a post to a web endpoint, even if the page you display does not have a submit button.
Edit
This would be an example of security through obscurity and is generally not a best practice. Asp.Net "submit" buttons modify a hidden form field called __EVENTTARGET. The asp.net handlers will inspect this field when determining a button click "event". This value can be spoofed if the attacker knew the name of the event target.
Hiding/showing UI elements are good for improving the user experience, but you should always validate (on the server) user input before performing any business actions.
I don't believe it would, if it's not rendered it shouldn't accept the postback. .net uses hidden fields on the page to know which controls were on the page and can verify that during postback, so it knows what triggered the post back. if the control was not there to begin with it shouldn't accept it.
Yes, this is definitely possible. ASP.NET accepts all POST values for controls defined on the page, visible or not. Beware too of i.e. textfields that are set to "read-only". Don't use readonlyControl.Text after the post, and trust that it has the same value as it had the last time you set it.
Take a look at what is posted when you perform a submit with ASP.NET with i.e. Chrome Developer tools, Fiddler, etc, and you should be able to figure out how to add your own value to an "invisible" text field.

Drupal: send output to user in form's submit handler, instead of redirecting

I have this basic Drupal scenario and question:
I have a form which accepts some input from user, and a submit handler which should process data and show the result to user. In other words, I don't write anything in database or set e variables etc., just show some output to user.
I was wondering how I can do this, because a submit handler redirects the flow to another menu item -which the form values ($form_state) are not available anymore. Redirecting form to itself is not useful, because I just receive the raw posted inputs -not processed $form_state.
How can I prevent the redirection and just show some output to user in submit handler?
Thank you.
When you are building your form you want to set re-direct to false:
$form['#redirect'] = FALSE;
There is more on redirect here: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#redirect
If I have understood your question correctly this is what you are after.

Legacy ASP.NET 1.1 with jQuery integration problem

I am working on a legacy web application written in VB.NET for ASP.NET 1.1. One particular page has a form with a number of fields. In response to a drop-down box changing value, I am clearing a number of fields, resetting a number of drop-down boxes to the first option, and setting them all to "disabled" in the UI. To do this, I'm using jQuery. I add a CSS class to all of these fields, and then my jQuery selector is something like the following: $("*.my-css-class"). Here's some sample code to explain.
var fields = $("*.fields");
if (some_condition) {
fields.val("");
fields.attr("selectedIndex", 0);
fields.attr("disabled", "disabled");
}
The UI updates as expected in response to the above js code, but when I post back the page in response to a button click, the original values still persist on the server-side related to these controls. For instance, txtSomething is one of the fields with a CSS class "fields" (so it will get selected by the above jQuery selector). The user types "1234" in this text box and submits the form. Either the same page is posted back to itself retaining its values, or I return to this page and prepopulate the values on the server-side (for example, the user clicks an Edit button on a summary page), so the control txtSomething is initialized on the client with the value "1234". My jQuery code clears the value as far as the user sees it in the UI, and then the user clicks a submit button. If I interrogate the value with a jQuery selector, the value of this field is an empty string. When the page is posted back and I'm stepping through the code (or doing something with the value of this control), it is still "1234".
A very important point to make is that these values are sent back to the browser after being submitted once. So, picture a form being submitted, or any case where these values are bound or set on the server-side and outputted to the browser pre-populated (as opposed to being output to the browser with default or empty values). If I load the page as default (empty text boxes), enter some text, and then trigger the js function to clear these fields, the value I typed never makes it to the server.
why do you need to disable those fields? Disabling controls can make them not post values to the server ... at least that is what happens when an asp.net control is disabled server side.
Update 1: couldn't take having the doubt if it was only server side, so I looked it up :) http://www.w3.org/TR/html401/interact/forms.html#h-17.12.1 ... "In this example, the INPUT element is disabled. Therefore, it cannot receive user input nor will its value be submitted with the form.", so I was right, even when disabling it client side it won't post the value

Resources