?
Solved

Age old question - Validating a rich text field or manipulate text field on web to show appropriately (in R5.0.12)

Posted on 2006-05-04
22
Medium Priority
?
643 Views
Last Modified: 2013-12-18
Greetings learned colleagues,

I did a search but am still a little confused with how I should go about validating a rich text field. I've read that you should use a text field so why use a rich text field? Because the text field appears very small on the web, the words scroll off to the right and you cannot wrap. So (1) can I check that the rich text field is not empty using a computed text field that uses the value of the rich text field converted to text after a uidoc refresh in the querysave event  or (2) how do I manipulate the text field on the web so that it shows up appropriately (it should look like you have the ability to type in a long sentence and wrap as well) and be able to carry out the validation as well. Anything entered in the Notes client should show up on the web and anything entered on the web should show up in the Notes client. The important thing here is that the validation check happens and that the field is not empty.

For (1)
field, rich text, editable called explanation
field, text, computed with value of @Text(explanation) called explanation_DSP
test in querysave after the refresh (will the explanation_DSP field contain text or will the document have to be saved before the refresh will work?)

And since it looks like there are really 2 questions, I'm allocating the max number of points.

Thank you for your suggestions and help.
0
Comment
Question by:notesrookie
  • 7
  • 7
  • 4
  • +2
21 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16610622
You can have a multi-line text field on the web. On the HTML-tab of the Field Properties window, specify the # lines and columns to show, using
    COLS=n ROWS=m

See also:
    http://www.htmlcodetutorial.com/forms/_TEXTAREA_COLS.html
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 16610946
If you know that it is ONLY going to be text in the RTF ( No pictures etc ),  then you should be able to extract and check

a UIdoc reload will show up in Notes before a save, not sure about refresh.

I hope this helps !
0
 
LVL 18

Accepted Solution

by:
marilyng earned 900 total points
ID: 16611154
I do two things.. I check the size of the field using NotesITem.text and if the document  has embedded or attached. (client side)

To get: itemText$ = notesItem.Text  < check if there is any text value, but not embedded or attached.  

http:Q_21825756.html#0 "Cannot see entire text field in web form in edit mode"  <<didn't we solve the wrapping problem for you?

Web side, use javascript.  And you can either validate on the lost focus or on the form submit.  (Get's a bit tricky with the lost focus validation).

There are three thousand javascript validation examples.  But you can also cycle through document.forms[0].elements until the object has a .type of "file" to see if you have attached files.

0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
LVL 22

Assisted Solution

by:mbonaci
mbonaci earned 600 total points
ID: 16614262
Hi notesrookie,
client:

Function IsRTFNull(rtfield As String) As Integer
    'This function tests a Rich Text field to see whether or not it
    'is null. It returns TRUE if the field is null, and returns
    'FALSE if the field is not null. It works even if the rich
    'text field contains a file attachment, doclink, or OLE
    'object but does not contain any 'text.

    On Error Goto Errhandle

    Dim workspace As New NotesUIWorkspace
    Dim uidoc As NotesUIDocument
    Set uidoc = workspace.CurrentDocument

    Call uidoc.ExpandAllSections
    'This is only needed if your field is in a section that may be closed when this executes

    Call uidoc.GotoField(rtfield)
    Call uidoc.SelectAll

    'The next line will generate a 4407 error message if the Rich Text Field is null

    Call uidoc.DeselectAll

    IsRTFNull = False

    Exit Function


Errhandle:
    Select Case Err
    Case 4407
        'the DeselectAll line generated an error message, indicating that the rich text field does not contain anything
        If currentfield <> "" Then
            Call uidoc.GotoField(currentfield)
        End If
        IsRTFNull = True
        Exit Function
    Case Else
        'For any other error, force the same error to cause LotusScript to do the error handling
        Error Err
    End Select
End Function

Hope this helps,
Marko
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16618876
Marko -  she specified both web and notes. :)
0
 

Author Comment

by:notesrookie
ID: 16643947
Only text in these rich text fields. Attachments go in another field. And yes for both Notes and Web. Thanks
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16644005
So, did marko hit and run? Don't want to intrude on his answer unless he's abandoned this.
0
 

Author Comment

by:notesrookie
ID: 16652126
Sorry folks, still in testing mode. Will get back to you. Thanks.
0
 
LVL 22

Expert Comment

by:mbonaci
ID: 16666596
I think I rushed a bit here...
It works in the client (the function is well commented).
0
 

Author Comment

by:notesrookie
ID: 16678311
OK folks, maybe I'm shooting myself in the foot but I've decided to go with text fields. We started on that about the issue on the web browser side but I don't think we finished on that one. So could we please continue? Thanks.
0
 
LVL 18

Assisted Solution

by:marilyng
marilyng earned 900 total points
ID: 16678889
I'm sorry, I've lost track of the question.. are you trying to validate fields web side?  If so, use javascript validation, and on the submit button, or the form onsubmit event use:  "javascript:ValidateMe(this)"

http://www.4guysfromrolla.com/webtech/091998-1.shtml << good place for javascript examples.

I have this massive validation.js that is a combination of everything from email addresses to phone numbers, and all I do is pass in the right parameters.

Now, you can validate on the field side, (onblur, etc) so that the user doesn't have to mash a submit button in order to get a list of invalid entries, but you also validate on the submit, too.

Since you can paste the javascript so that it runs in client and on web, you can use it both ways.
 
I have used the isEmpty and isWhitespace for most validations.  

See if this works for you.
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16678936
Regarding>>2) how do I manipulate the text field on the web so that it shows up appropriately (it should look like you have the ability to type in a long sentence and wrap as well) and be able to carry out the validation as well.

Didn't we do this here?: http://www.experts-exchange.com/Applications/Email/Lotus_Notes_Domino/Q_21825756.html

Just confused, that's all
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16678947
Oops, R512 >>Since you can paste the javascript so that it runs in client and on web<<  

Revise: your choices:

1-Do the javascript on the web, and whatever validation you want on client.
2-Write the validation in an agent, either formula or lotusscript, and call it from the webquerysave in the web client.

I'll save the other EE's some effort here, and not suggest/insist you upgrade :)

0
 

Author Comment

by:notesrookie
ID: 16694730
I must apologize for the silence. My server died on Friday morning and had to be rebuilt as a Domino 6.5 server (so I had to upgrade after all). It was a long weekend and Monday as well for the recovery of the databases that were corrupted. So I guess this is a positive for transaction logging?

marilyng - we did cover it but I may have been confused. It seemed as if I was missing some information or just reading it wrong. I'll check on the weblink you sent when I get back from vacation at the end of the month. Thanks.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16694858
Poor server... *sob* Requiescat in pace... *sob* But, like a Phoenix, it rises from its ashes as... R6.5.1!!  Never seen a better-timed demise... No "active euthanasia" I hope?? ;)

Transaction logging is definitely one of the options of the new server. And there are more improvements, you'll be amazed. You'll also be rolling out newer clients or not?

Have a nice vacation!
0
 
LVL 18

Expert Comment

by:marilyng
ID: 16695701
Well, I hope I didn't jinx everything..!! It's been a standard response in a lot of questions.. "oh, got a problem, well, just upgrade that server and clients, that'll solve it!"

Have a good vacation, you'll be saving lot's of time now that you're up to 6.5
0
 

Author Comment

by:notesrookie
ID: 16702516
Heh, heh, heh! No, not active euthanasia (although I was tempted) or jinxing. The normal, just let it run, it doesn't need any maintenance on the system files (on a w2k os platform no less). So it was just a matter of time. The other thing I suspect that probably caused a problem is that the clients were already on R7 writing to an R5 server. <Shudder> The server will be too once I get back from vacation. And implementing some maintenance, increased frequency of backups, cluster another domino server, etc., etc., etc.

And the question was - have the text field show up on the web form with room for the user to enter data in and have the ability to wrap and scroll, validate the data and also make sure that this information shows up on the Notes client side as well. Do you have any simple samples that I can look through?

Thanks.
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16706704
You can have a multi-line text field on the web. On the HTML-tab of the Field Properties window, specify the # lines and columns to show, using
    COLS=n ROWS=m

See also:
    http://www.htmlcodetutorial.com/forms/_TEXTAREA_COLS.html

Hm, looks pretty similar to my first post...
0
 

Author Comment

by:notesrookie
ID: 16777320
I apologize for my silence. I just got back from vacation and am not officially back at work.

Would it be possible to keep this question open until I get back to work on Tuesday, May 30, 2006?

Thank you.
0
 

Author Comment

by:notesrookie
ID: 16777856
Oops - I meant to say that I am still on vacation having just gotten back from being out of the country. There was only 1 internet terminal in the entire hotel. ;-)
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 16778792
So you should recommend the hotel!
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Suggested Courses

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question