Hi
what i want is simple:
the user should be warned if he enters a number in a field whose length is not 13!
He should be warned just once!
It doesnt matter if i do it with formula or lotusscript!
My form is automaticly refreshed!
Thanks
Hi
what i want is simple:
the user should be warned if he enters a number in a field whose length is not 13!
He should be warned just once!
It doesnt matter if i do it with formula or lotusscript!
My form is automaticly refreshed!
Thanks
Subject: Little problem but noone can help
I guess there is many way to do it, but you can put this in field validation, hope it helps
@If(@Length(@ThisValue)>13;@Failure(“To long string”);@Success)
or whit lotusscript in Exiting:
Dim uidoc As notesuidocument
Dim ws As New NotesUIWorkspace
Set uidoc = ws.CurrentDocument
If Len( uidoc.FieldGetText("fieldN")) > 13 Then
Msgbox ("error, to long string")
End If
Subject: RE: Little problem but noone can help
It should just warn the user not stop im from saving. and it should warn him just once!
Subject: RE: Little problem but noone can help
If it’s not going to stop the user from saving, then it shouldn’t be in the validation event. You can put the following in the input translation event:
@if(@Length(jmbg)<>13 & Dummy!=“1”;@do(@Prompt([ok];“”;“Wrong”);@setfield(“Dummy”;“1”);jmbg);jmbg)
Dan
Subject: Little problem but noone can help
You have not been successful doing this with a validation formula for the field?
Subject: Little problem but noone can help
This works for me. It is in the Input Validation of the numeric field:@If(@Length(@Text(@ThisValue))!=13&dummy!=“1”;
@Do(@SetField(“dummy”;“1”);@Failure(“Field must be 13 digits”));
@Success)
Dummy does not exist as a defined field on the form. You may also want to put something in the QuerySave to remove dummy from the document so that it will validate the next time the form is edited.
Regards,
Don
Subject: RE: Little problem but noone can help
It seems Don’s solution (and others) should work Change the name of the field dummy to WarnFlag or something if you want. What nice about Don’s is if you don’t want people to get the warning AFTER it has been saved, they won’t.
I guess what we are confused by is when you want the warning?
After they entered the value and move out of the field? Then you want to use the exiting code posted.
When they are saving?
When the form is refreshed?
Do you only want the warning when the user is first entering the form and never again.
Subject: Little problem but noone can help
You only asked this question about 10 posts ago - why repeat it? Read:
Why though do you want the user only warned once? What happens the second time he tries to save the doc and he’s got the wrong length in the field? Does it then save OK, or just not give the user any warning at all but still not save? How does the user know when he’s got the right length in the field?
Don’t think you can do what you’re trying to do in a validation formula though, you might need to move it into querysave and do it in lotusscript.
Dan
Subject: RE: Little problem but noone can help
It should just warn a user!
It is a JMBG, something like the unique ID of people on state level!
But sopme users have a JMBG with length 12 and it is still valid!
They should just be warned to check the JMBG! And proceed normaly!
Lot of people have answered but it doesnt work! Its simple there must be a solution!
Thanks
Subject: RE: Little problem but noone can help
I suggest you use some of the code provided (esp. the LS) and enter it into the Exiting event of the field…
You may also need to refresh the user interface doc…
Something like:
Sub Exiting(Source As Field)
Dim s As New NotesSession
Dim ws As New NotesUiWorkspace
Dim Uidoc As NotesUidocument
Set Uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Dim db As NotesDatabase
If
'Use the code from others to determine the lenghth of the field
{insert the code provided by other people here!}
Then
'enter a messagebox function here - look it up in notes help!
'afterwards, you may need a uidoc.Refresh
Call uidoc.Refresh
(you may not need the refresh if form is set to automatically refresh fields)
btw…I think you are mis-understand the validation.
This will:
Always prevent the user from saving if the document is not valid, and display the message each time;
Always display the message when tabbing out of the field if it’s content are not valid (depending on refresh options)
It’s really not what you want - you seem to just want to display a message to the user…
Subject: RE: Little problem but noone can help
After the message box has appeared update a temporary field with status “Yes”. And in the LS write the if condition -
Sub Exiting(Source As Field)
Dim s As New NotesSession
Dim ws As New NotesUiWorkspace
Dim Uidoc As NotesUidocument
Set Uidoc = ws.CurrentDocument
Set doc = uidoc.Document
Dim db As NotesDatabase
If
'Use the code from others to determine the lenghth of the field
{insert the code provided by other people here!}
Then
if tempstatus = “No” then
msgbox “Your alert msg goes here”
tempstatus = “Yes”
end if
uidoc.save
uidoc.refresh
End Sub
As this field is set to “Yes”, the user will not see msgbox again.
Is this document user specific…(I mean, whether the document once set with “Yes” if opened by others should they get msgbox?)
–Phani
Subject: RE: Little problem but noone can help
Never thought about it, your absolutely right, what I just wrote was a simpel answer to him. of course you have to consider that if the document is saved and so on.
Querysave is a good place to put or under the save button if it’s done by lotusscript. there is many ways to do it.
Subject: Little problem but noone can help
Heeeeeeeeey
I have never recieved so many responses on a single post!
It works perfectly with exitinf event of jmbg field! It is just a notice to a user that his entry may not be correct!
Thanks to all of you!
Subject: RE: Little problem but noone can help
This is the answer to the question I think you are asking. If not, please ask your question more clearly:
Use an input validation formula such as this:
@If((@IsDocBeingSaved | @IsDocBeingMailed) & @Length(@ThisValue) != 13; “The verylong number must be 13 characters long.”; @Success)
This will prevent the message from appearing when the document is autimatically refreshed – the system will complain about this field only when the user tries to save the document.
If that is not what you need, then please describe step by step what you would like to happen and when. There’s a way to do it, but we would have to know what “it” is.
Subject: Little problem but noone can help
Thanks to all of you!
I couldnt do it with formula in validation because the value of field dummy just wouldnt change! Dont ask me why!
I have managed it with exiting event on thr jmbg field!
Thanks again
Branimir
Subject: RE: Little problem but noone can help
Possibly…it doesn’t want to set a field as part of a validation formula.IMHO a quite strange thing to do…
Exiting events work in a completely different way, by design than validation: they are for different purposes… I guess sending the user a message (not validating the field) is one of these…