Solved

How hard to change this formula to JavaScript

Posted on 2004-03-31
13
414 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

For Desktop Techs: How to retain a user's Notes configuration data when swapping out the end user's computer. (Assuming that you are not upgrading to a completely different version of Notes client) All you need to do is: 1) install Notes o…
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…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

920 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

20 Experts available now in Live!

Get 1:1 Help Now