LotusScript Action Buttons not showing in a browser

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.  
JaziarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill-HansonCommented:
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
JaziarAuthor Commented:
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
Bill-HansonCommented:
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
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

JaziarAuthor Commented:
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
Bill-HansonCommented:
Right.  Each action button will use that same base url, but the parameters at the end of the url will differ.
0
JaziarAuthor Commented:
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
Bill-HansonCommented:
Exactly!  Or, you could design 2 forms and hide each one appropriately.
0
JaziarAuthor Commented:
I am going to try the URL buttons
0
Bill-HansonCommented:
Let me know if you need help parsing the URL into the fields.
0
JaziarAuthor Commented:
I do - could you look at the above script and show how to include all the sets
0
JaziarAuthor Commented:
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
Bill-HansonCommented:
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
JaziarAuthor Commented:
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
Bill-HansonCommented:
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
JaziarAuthor Commented:
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
Bill-HansonCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JaziarAuthor Commented:
Yes that works
0
Bill-HansonCommented:
Do I get credit for both questions???   :)
0
JaziarAuthor Commented:
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
Bill-HansonCommented:
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
JaziarAuthor Commented:
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
Bill-HansonCommented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.