To ensure more security to my XPages web application, I put a captcha in the custom login form in domcfg.nsf.
I followed the link to build my captcha :
http://www.notesmail.com/home.nsf/tip20100506
The problem is when log in, if the captcha is misunderstood , I can not update the value of the field to reasontype it makes me appear the message "Wrong captcha code."
I added this action to check if the text entered is equal to captcha :
#If ( #UpperCase ( MyCaptchaField ) = TheRealValueOfMyCaptcha ; FIELD reasontype: = "6" ; "")
and I added a condition that shows me an error in the calculated field error messages if the value of reasontype is equal to "6" .
This does not work and I can access my XPage even if the captcha is not written.
I feel that the reasontype field depends only 5 predefined conditions.
Is there a solution to add other conditions in log on form?
You've got a space between the colon and equal characters. That means the characters are treated as two operators - a list concatenation operator and an equality operator.
Instead of this
#If ( #UpperCase ( MyCaptchaField ) = TheRealValueOfMyCaptcha ; FIELD reasontype: = "6" ; "")
You need this:
#If ( #UpperCase ( MyCaptchaField ) = TheRealValueOfMyCaptcha ; FIELD reasontype := "6" ; "")
However, the classic style for this would be:
FIELD reasontype := #If ( #UpperCase ( MyCaptchaField ) = TheRealValueOfMyCaptcha ; "6" ; "");
You have syntax error there...This is corrected code:
#If ( #UpperCase ( MyCaptchaField ) = TheRealValueOfMyCaptcha ; FIELD reasontype := "6" ; "")
That code is for an old-style Domino web form, not XPages. An alternative would be using an XPages-specific implementation and using an AJAX login post. Here are a couple of OpenNTF I found:
https://www.openntf.org/main.nsf/project.xsp?r=project/Xpages%20Captcha%20Custom%20Control
https://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=Recaptcha%20Custom%20Control
Here is a blog post which points to another OpenNTF project by Declan Lynch with an AJAX login Custom login forms in xpages?
Here is also an XSnippet for a login custom control (doLogin is the SSJS method to log in) https://openntf.org/XSnippets.nsf/snippet.xsp?id=dojo-login-dialog-custom-control
I tried this code. But the problem is that it automatically connects to my application and ignore the validation of the captcha.
I found a solution with a redirect to the logout page in the "onsubmit" action if the captcha is wrong and it works and a web alert to avoid the reasontype field.
Thanks for your help.
Related
So, I'm much more familiar with Transact-SQL than I am with Crystal formulas. What I would like to do is convert something like the following SQL where clause to be used in Crystal to conditionally suppress a section:
.
.
.
AND (osAddressUse.Description <> 'Conservator Address'
OR (
ISNULL(bcDocumentDetail.PrimaryStreet,'') = ISNULL(osaddress.PrimaryStreet,'')
AND
ISNULL(bcDocumentDetail.SecondaryStreet,'') = ISNULL(bcDocumentDetail.SecondaryStreet,'')
)
)
.
.
.
Basically, the section should only display if the osAddressUse.Description = "Conservator Address" OR both the Primary Street and Secondary Street within both tables bcDocumentDetail and osAddress are not identical.
What I came up with so far is the following, but it doesn't work 100% of the time:
{osAddressUse.Description} <> "Conservator Address"
OR
( {bcDocumentDetail.PrimaryStreet} = {osAddress.PrimaryStreet}
AND
{bcDocumentDetail.SecondaryStreet} = {osAddress.SecondaryStreet} )
There are some situations where the data in these fields can either be NULL or "". If it's a NULL value, I want it converted to "", that way, they technically match, and the section will be suppressed.
Nevermind. I was able to figure it out:
TRIM ({osAddressUse.Description}) <> "Conservator Address"
OR
(
(IF ISNULL({osAddress.PrimaryStreet}) THEN "" ELSE {osAddress.PrimaryStreet})
= (IF ISNULL({bcDocumentDetail.PrimaryStreet}) THEN "" ELSE {osAddress.PrimaryStreet})
AND
(IF ISNULL({osAddress.SecondaryStreet}) THEN "" ELSE {osAddress.SecondaryStreet})
= (IF ISNULL({bcDocumentDetail.SecondaryStreet}) THEN "" ELSE {osAddress.SecondaryStreet})
)
I'm trying to create a multi select function by adding and removing record IDs into a global field.
I've created a global field called current_selection.
I attached a script action to the name field that is suppose to add or remove the record id to the global field.
If ( PatternCount ( committee::current_selection; committee::id & "¶"); Substitute ( committee::current_selection; committee::id &"¶"; "¶"); committee::id & "¶" &committee::current_selection)
and that is how i set the global field.
Meanwhile I set conditional formatting for the name field for a visual of what is selected
PatternCount ( committee::current_selection; committee::id & ¶)
so what happens is 1 is selected when 11 is selected then if I click 1 it takes 1 off 11
Not sure why this is happening
Well, "1" is included in "11", so your test produces a false positive. And substituting "1¶" out of "11¶" leaves "1".
To see if an item exists in a list of return-separated values, use:
IsEmpty ( FilterValues ( item ; listOfValues ) )
Removing an item from a list is more difficult than it might seem. Start with:
Substitute ( ¶ & listOfValues & ¶ ; ¶ & item & ¶ ; ¶ )
then remove the extra carriage returns from the result.
I am using FMP 14 and would like to auto-populate field A based on the following calulation:
If ( Get ( ActiveLayoutObjectName ) = "tab_Visits_v1" ; "1st" ) or
If ( Get ( ActiveLayoutObjectName ) = "tab_Visits_v2" ; "2nd" ) or
If ( Get ( ActiveLayoutObjectName ) = "tab_Visits_v3" ; "3rd" ) or
If ( Get ( ActiveLayoutObjectName ) = "tab_Visits_v4" ; "4th" ) or
If ( Get ( ActiveLayoutObjectName ) = "tab_Visits_v5" ; "5th" ) or
If ( Get ( ActiveLayoutObjectName ) = "tab_Visits_v6" ; "6th" )
The above code is supposed to auto-populate the value 1st, 2nd, 3rd ... in field A depending on the name of the object the Get (ActiveLayoutObjectName) function returns. I have named each of my tabs, but the calculation is only returning 0.
Any help would be appreciated.
thanks.
The way your calculation is written makes very little sense. Each one of the If() statements returns a result of either "1st", "2nd", etc. or nothing (an empty string). You are then applying or to all these results. Since only of them can be true, your calculation is essentially doing something like:
"" or "2nd" or "" or "" or "" or ""
which happens to return 1 (true), but has no useful meaning.
You should be using the Case() function here:
Case (
Get ( ActiveLayoutObjectName ) = "tab_Visits_v1" ; "1st" ;
Get ( ActiveLayoutObjectName ) = "tab_Visits_v2" ; "2nd" ;
Get ( ActiveLayoutObjectName ) = "tab_Visits_v3" ; "3rd" ;
Get ( ActiveLayoutObjectName ) = "tab_Visits_v4" ; "4th" ;
Get ( ActiveLayoutObjectName ) = "tab_Visits_v5" ; "5th" ;
Get ( ActiveLayoutObjectName ) = "tab_Visits_v6" ; "6th"
)
Note also that a calculation field may not always refresh itself as a result of user switching a tab. This refers to an unstored calculation field; if you are trying to use this as the formula to be auto-entered into a "regular' (e.g. Text) field, it will never update.
Added:
Here is our situation. We see a patient a maximum of 6 times. We have
a tab for each one of those 6 visits.
I would suggest you use a portal to a related table of Visits instead of a tab control. A tab control is designed to display fixed components of user interface - not dynamic data. And certainly not data split into separate records. You should have only one unique record for each patient - and as many records for each patient's visits as may be necessary (potentially unlimited).
If you like, you can use the portal rows as buttons to select a specific visit to view in more detail (similar to a tab control, except that the portal shows the "tabs" as vertical rows). A one-row portal to the same Visits table, filtered by the user selection, would work very well for this purpose, I believe.
With 1. .... it would be easy:
Right (Get ( ActiveLayoutObjectName ) ; 1) & "."
Thanks for pointing out, that my first version does not work.
I was working with an Access 2013 database and had a question about the "Enter Parameter Value" box. I am using a Form whose record source is tied to a "Select" query.
If the query finds the result I'm looking for, it populates the form with its values. If the query fails, it keeps the form blank for a new entry to be made by users.
Some of my users have been complaining that they'd like to pass the value they initially put into "Enter Parameter Value" to the form if the query fails so they don't have to enter data twice into the form.
Is it possible to pass a value from "Enter Parameter Value" to the form box instead of too a query?
One way would be enter the value in a form box and then programmatically pass the value as parameter to your query.
some pseudo:
Open the querydef
Set the parameter value
Set the query as form's rowSource
Some code:
check here:
http://bytes.com/topic/access/answers/887449-how-pass-parameter-value-query-via-vba
in Access 2010 and 2013
This uses DAO and might be of interest
DIM MyQryDef as querydef
Dim a as string
a = ""
a = a & "PARAMETERS Parameter1 INT, Parameter2 INT; "
a = a & "SELECT f1, f2 FROM atable WHERE "
a = a & "f3 = [Parameter1] AND f4 = [Parameter2] "
a = a & ";"
Set MyQryDef = currentdb().CreateQueryDef("MyQueryName", a)
MyQryDef.Parameters("Parameter1").Value = 33
MyQryDef.Parameters("Parameter2").Value = 2
' You could now use MyQryDef with DAO recordsets
' to use it with any of OpenQuery, BrowseTo , OpenForm, OpenQuery, OpenReport, or RunDataMacro
DoCmd.SetParameter "Parameter1", 33
DoCmd.SetParameter "Parameter2", 2
DoCmd.Form YourFormName
' or
DoCmd.SetParameter "Parameter1", 33
DoCmd.SetParameter "Parameter2", 2
DoCmd.OpenQuery MyQryDef.Name
See here:
https://msdn.microsoft.com/en-us/library/office/ff194182(v=office.14).aspx
Harvey
I'm working on a report in Crystal Reports XI that allows someone to filter help desk tickets using a number of optional dynamic parameters. If I make a selection for each parameter it returns the expected results, but if I leave out any of the parameters it doesn't return anything and when I look at the SQL query it says, "No SQL Query is used because the record selection formula returns no records." I currently have the following code for Record Selection:
{Incident.State:} = "C" and
{Incident.Close Date & Time} in {?BDate} to {?EDate} and
If HasValue({?Group}) Then (
{Groups.Code} = {?Group}
)
and
If HasValue({?Category}) Then (
{Incident.Subject Description} = {?Category}
)
and
If HasValue({?Staff}) Then (
{Incident_Details.Login ID} = {?Staff}
)
and
If HasValue({?Community}) Then (
{Incident.Company Name} = {?Community}
)
To me, this seems like it should work and if I leave out the If statement to verify the parameters have values I get an error so it seems like the HasValue is working properly. Any ideas?
Your problem stems from not explicitly handling the optional parameter configurations. It's easy to run into this problem when using if-statements in the record selection formula. Instead, explicitly handle the cases where the parameters DO and DO NOT have values. Something like this:
...
(not(hasvalue({?Group})) or {Groups.Code}={?Group})
and
(not(hasvalue({?Category})) or {Incident.Subject Description} = {?Category})
and
(not(hasvalue({?Staff})) or {Incident_Details.Login ID} = {?Staff} )
and
(not(hasvalue({?Community})) or {Incident.Company Name} = {?Community})
Doing it this way effectively tells CR to just ignore the parameter if is doesn't have a value, otherwise select records based on what was entered in those parameters.
The Record Selection formula indicates whether a record must be used, or not, by returning true or false. With that in mind, if some value is informed, the formula must return True if it meets some criteria. If nothing is informed on the filter, the formula must always return True.
Try something like this:
{Incident.State:} = "C" and
{Incident.Close Date & Time} in {?BDate} to {?EDate} and
(If HasValue({?Group}) Then (
{Groups.Code} = {?Group}
) else
(True))
and
(If HasValue({?Category}) Then (
{Incident.Subject Description} = {?Category}
) else
(True))
and (
If HasValue({?Staff}) Then (
{Incident_Details.Login ID} = {?Staff}
) else
(True))
and (
If HasValue({?Community}) Then (
{Incident.Company Name} = {?Community}
) else
(True))