Solved

LotusScript Action Buttons not showing in a browser

Posted on 2007-03-29
22
745 Views
Last Modified: 2013-12-18
When I am viewing my database through a browser, none of my action buttons show up that are LotusScript.  If I open a view and change the script to a formula and refresh my browser, the buttons show up.  I then change them back to script, refresh and poof they are gone.  
0
Comment
Question by:Jaziar
  • 11
  • 11
22 Comments
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18818463
Domino automatically hides your actions because they use LotusScript.  LotusScript does not run in the Web browser except via the WebQueryOpen and WebQuerySave agent events.  
0
 

Author Comment

by:Jaziar
ID: 18818924
That is a major problem for me.  I have 3 action buttons that have to run.  Any Suggestions.  Here is a sample of script.

Sub Click(Source As Button)
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Dim doc As NotesDocument
      Dim db As NotesDatabase
      Dim session As New NotesSession
      Dim userName As String
      userName = session.CommonUserName
      Set db = ws.CurrentDatabase.Database
      Set doc = New NotesDocument(db)
      doc.Form = "EC Request"
      doc.ModuleAffected = "AIO"
      doc.Status = "Working"            
      doc.Requester = userName
      doc.ModUser = userName
      doc.ModDate = Date$
      doc.ModAction = "Working"
      Call doc.Save(True, False)
      Set uidoc = ws.EditDocument(True, doc)
End Sub

Can I change it to javascript?
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18819037
Use a Notes Url to compose the new document, passing the values you need to set in the URL.  In the EC Request form's WebQueryOpen event, you can parse the URL to set the default values or you can try to parse the values directly on the form using formula language if you don't want to use WebQueryOpen.  I've used both methods in my apps.

Sample URL:  http://www.host.com/database.nsf/EC+Request?OpenForm&ModuleAffected=AIO&Status=Working
0
 

Author Comment

by:Jaziar
ID: 18819078
The problem is I have 3 programs in the database.  So there are 3 action buttons.  

Create Print ECR
Create Color ECR
Create Mono ECR

They use the same form but assign different values.
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18819106
Right.  Each action button will use that same base url, but the parameters at the end of the url will differ.
0
 

Author Comment

by:Jaziar
ID: 18819461
so I would have a client button with the script and hidden from the web and a web button for the browser hidden from the client.
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18819706
Exactly!  Or, you could design 2 forms and hide each one appropriately.
0
 

Author Comment

by:Jaziar
ID: 18822939
I am going to try the URL buttons
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18823445
Let me know if you need help parsing the URL into the fields.
0
 

Author Comment

by:Jaziar
ID: 18823565
I do - could you look at the above script and show how to include all the sets
0
 

Author Comment

by:Jaziar
ID: 18835980
I have tried this

@URLOpen("https://serverdb/lincs24.nsf/EC+Request?OpenForm&ModuleAffected=AIO&Status=Working")

It opens the form, but does not set any of the values.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18836489
In the target form, I use two fields to accept the parameter names and values, then I parse the values into each field as needed.  Here's how to set up the parameter fields:

1.  Create a new field toward the top of your form called ArgNames (Text, Computed for display, multiple values).
    - Enter this formula for the ArgNames field:
      @Left(@Explode(@Right(Query_String_Decoded;"&");"&");"=")

2.  This part is cool:  We need to hide this field, but still make the values accessible, so on the field's hide properties tab, hide the field from the Notes client.  Don't hide it from the web because this would make the values inaccessible to some code.  Instead, wrap the field up with pass through HTML like this:
    <input name='ArgNames' id='ArgNames' value='[ArgNames]' type='hidden' />
    - Replace the text [ArgNames] with the actual ArgNames field so that the field is embedded directly inside the pass through HTML.  This will expose the ArgNames field to @Formula and JavaScript code, but hide it from people.

3.  Create a new field toward the top of your form called ArgValues (Text, Computed for display, multiple values).
    - Enter this formula for the ArgValues field:
      @Right(@Explode(@Right(Query_String_Decoded;"&");"&");"=")

4.  Hide the ArgValues field in the same way we hid the ArgNames field:
    <input name='ArgValues' id='ArgValues' value='[ArgValues]' type='hidden' />

Ok, the hard part's done.  Now you have one field that contains all of the parameter names (Argnames) and another that contians all of the parameter values (ArgValues).  All we have to do now is to get the values into the right fields.

5.  For each field (ModuleAffected) for example, ether the following code for Default Value (or computed value):
      index := @Member("ModuleAffected"; ArgNames);
      @If(index > 0; ArgValues[index]; "")

6.  Repeat step 5 for each field, substituting the actual field name.

That's it!  Here's a sample URL formula for @URLOpen:

@URLOpen(@URLEncode("https://serverdb/lincs24.nsf/EC+Request?OpenForm&ModuleAffected=AIO&Status=Working&Requestor=" + @Username + "&ModUser=" + @Username + "&ModDate=" + @Text(Date) + "&ModAction=Working"))
0
 

Author Comment

by:Jaziar
ID: 18837886
On this part

<input name='ArgNames' id='ArgNames' value='[ArgNames]' type='hidden' />

Are we doing this in the HTML tab of the field?

It has ID - Class - Style - Title - Other

I am not sure how to do this step?
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18838638
No, directly on the form.  What we are doing here is wrapping a standard field in some pass-through HTML so that we can access its values from any code (@Formula, Javascript, etc).

1.  Paste the text toward the top of your form.
2.  Set the text to be pass-through HTML.
3.  Delete the part that says "[ArgNames]".
3.  Place your cursor where "[ArgNames]" used to be and create the ArgNames field.

Actually, it might be easier for you to leave off the HTML wrapper and just put (type='hidden') in the HTML tab of the field, but someday, you may need the wrapper.   The only real reason to wrap the field in HTML is to make the values accessible to Javascript.  I use a subform called Standard Web Fields that has definitions like this for many temp fields that I use on the web (all of the CGI variables, DB Path, DB URL, etc...).
0
 

Author Comment

by:Jaziar
ID: 18852338
I am not having much luck.  Here is what I have.

At the top of my form I have 2 fields

ArgNames
Computed for display
value - @Left(@Explode(@Right(Query_String_Decoded;"&");"&");"=")

ArgValues
Computed for display
value - @Right(@Explode(@Right(Query_String_Decoded;"&");"&");"=")


In the field ModuleAffected
Computed
value -
index := @Member("ModuleAffected"; ArgNames);
@If(index > 0; ArgValues[index]; "")


On my default view I have a test action button with

@URLOpen("https://server/ecr/lincs24.nsf/EC+Request?OpenForm&ModuleAffected=AIO")

I am just trying to get the one field working first.  It opens the form but does not assign a value.  I go in to the top two fields and remove the "type = hidden" tag, I still see no values.
0
 
LVL 22

Accepted Solution

by:
Bill-Hanson earned 250 total points
ID: 18901130
Ok, I just found out that there is a new function (R6) for getting URL parameters without resorting to the ArgNames and ArgValues fields.  These fields do work, I use them all the time, but now that IBM has given us a new function, I don't need them.

Try this:

Get rid of the ArgNames and ArgValues fields.
In your ModuleAffected field, put this code:
@UrlQueryString(@ThisName)

I just tried this in my test environment and it worked like a charm.
0
 

Author Comment

by:Jaziar
ID: 18901164
Yes that works
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18901188
Do I get credit for both questions???   :)
0
 

Author Comment

by:Jaziar
ID: 18904982
Being I gave you credit for both, what happens now I have changed the value of ModuleAffected.  My Client side lotusScript buttons now does not work.  How can I fix the default value to work with both?
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18905244
Use 2 buttons.  Hide one from the web and one from Notes.

I've tried to use write-once-run-anywhere for things like this before, but have not hade much success.  Something always comes up to ruin my best efforts (dang feature requests).

I just had a new idea!  Have you ever played with Notes urls?  I've just started using them, and they do come in handy, but I'm not sure that the @UrlQueryString function even works in the Notes client.  Anyway, I would probably just stick with the 2 button approach.

BTW, I was only half kidding about the points.  Let me know if I can help you further!
0
 

Author Comment

by:Jaziar
ID: 18905316
I have the two buttons, but my ModuleAffected field in the form has @UrlQueryString(@ThisName) and that will not work with my client button.  So when they click my client button - it does not work now.  I have a lot of code running off the value of ModuleAffected - so I can not have 2 fields
0
 
LVL 22

Expert Comment

by:Bill-Hanson
ID: 18905773
Easy!  Change the formula in the field to recognize when it is being used on the web.  Here's an example:

@If(@ClientType = "Notes"; @ThisValue; @UrlQueryString(@ThisName))
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now