Solved

How hard to change this formula to JavaScript

Posted on 2004-03-31
13
417 Views
Last Modified: 2013-12-18
This is a action button on my client - but of course the web side can't use it.  Can someone help me translate it to JavaScript?

count_comment_1 := @Prompt([OKCANCELEDIT]; "Counter Propose"; "Please Enter Counter Propose"; " ");
count_comment_2 := "Counter Propose: " + count_comment_1 + @NewLine + @Name([CN]; @UserName) + " " + @Text(@Now);
@SetField("GMMCom"; count_comment_2);

FIELD CMMDate := CMMDate;
@SetField("GMMDate"; @Now);
FIELD CMMStatus := CMMStatus;
@SetField("GMMStatus"; "Counter Proposed");
@Command([RefreshHideFormulas] );

@SetField( "ECRFlowState_2"; "Dell Counter Proposed");
@SetField( "Requester_Name_2"; @Name([CN]; @UserName));
@SetField("Request_Date_2"; @Text(@Today));

ecr_flow_state := ECRFlowState + @NewLine + @Text("Dell Counter Proposed");
@If(ECRFlowState != ""; @Do(@SetField("ECRFlowState_2"; ecr_flow_state); @SetField("ECRFlowState"; "")); "");
@SetField( "ECRFlowState_3"; "Submitted");
ecr_requester_name := Requester_Name + @NewLine + @Name([CN];@UserName);
@If(Requester_Name != ""; @Do(@SetField("Requester_Name_2"; ecr_requester_name); @SetField("Requester_Name"; "")); "");
@SetField( "Requester_Name_3"; @Name([CN]; @UserName));

ecr_status_date :=  Request_date+ @NewLine + @Text(@Now);
@If(Request_Date != ""; @Do(@SetField("Request_Date_2"; ecr_status_date); @SetField("Request_Date"; "")); "");
@SetField("Request_Date_3"; @Text(@Now));
ext_mail := @Trim(DellProEmail);
int_mail := @Trim(ECRRequester_d:LexProEmail);
subject := "Change Request # " + LexECRNum + "Project-" + Project + "   Request Topic-" + ECRSubject + " Has Been Counter Proposed.";
message := "The requested Change Request # " + LexECRNum + "has been Counter Proposed by " + CMMName + @NewLine + count_comment_2 + @NewLine + "Please click the link below to view the Change Request";

@MailSend(int_mail; ""; "";subject; ""; message + @NewLine+@NewLine; [IncludeDoclink]);
@PostedCommand([FileSave]);
@Command([FileCloseWindow])
0
Comment
Question by:Jaziar
  • 5
  • 4
  • 4
13 Comments
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10723941
You cannot convert the above formula as it is in JS.. There is no MailSend capability in JS code.. It it controlled by form header action.

So you have to redefine the functionality seperately for JS.

Seeing the  above code at a glance I feel there is nothing that will work in web except for @Prompt.. There is an equivalent function in JS called prompt. But I will propose you to create a blank field to accept the input on the form and place rest of the code in the button beside it and additionally place a check that the field is not null before you proceed in your code.

~Hemanth
0
 

Author Comment

by:Jaziar
ID: 10724139
So I would need two buttons - one would get the input from the web and after the field is not null a second button could appear to mail the comment?  Does that sound correct?
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10724596
Yes you can
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:p_partha
ID: 10725579
What you can ideally do is to do all the validations in the javascript and call the submit actino, In the webquerysave you can call an agent to send a mail

Hope i am clear

Let me know i can try changing the code and give it to you

Partha
0
 

Author Comment

by:Jaziar
ID: 10726869
Where am I going wrong

cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Counter Comment</title></head>'+
'<body><form><h3>Please Enter Reason For Counter</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="document.forms[0].CommentField.value;'+
'opener.document.forms[0].RefreshButton.onclick();window.close()">'+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');
cw.document.close();

Trying to get the typed in user value and assign it to the value counterText and then update the field CommentField on the form
0
 
LVL 14

Expert Comment

by:p_partha
ID: 10726959
Jaziar
there are some issues with it,

ur double quotes are place after onclick = , so it will treat that as a string


tell us exactly what u want to do

Partha

0
 

Author Comment

by:Jaziar
ID: 10727025
I want to have a dialog box to pop up where the user can add a comment - the comment value (text String) will then be placed in a field on the form named CommentField.  Then Refresh the form to show the value.  Everything works except placing the value in the field.
0
 
LVL 14

Expert Comment

by:p_partha
ID: 10727081
something liek this:


cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Counter Comment</title></head>'+
'<body><form><h3>Please Enter Reason For Counter</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.forms[0].CommentField.value =document.forms[0].counterText.value"'+
'opener.document.forms[0].RefreshButton.onclick();window.close()">'+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');
cw.document.close();
0
 

Author Comment

by:Jaziar
ID: 10727150
That works and the form refreshes witht the value but the window don't close.
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10727160
use cw.close instead of cw.document.close();
0
 
LVL 14

Accepted Solution

by:
p_partha earned 500 total points
ID: 10727193
cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Counter Comment</title></head>'+
'<body><form><h3>Please Enter Reason For Counter</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.forms[0].CommentField.value =document.forms[0].counterText.value;opener.document.forms[0].RefreshButton.onclick();self.close()"'+
">"+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10727206
First this not at all needed.. use prompt function like this

document.forms[0].CommentField.value = prompt( "Please Enter reason for counter", "-Enter Comments-");
0
 
LVL 14

Expert Comment

by:p_partha
ID: 10734560
Jaziar
Do you need any more help on this

partha
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Email relaying to outside address 4 180
Lotus Notes Mail Database issues 2 981
Lotus Notes mail can not print out Full page 8 1,380
Cannot access mail archive from IBM domino 5 110
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

696 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