473,288 Members | 1,704 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

Need advise on best method...

Hello all,

I am really really desperate on what I should do, and I am asking for help
from anyone in this newsgroup, here's the situation:

I am creating a form that is being run on a server where there is no scripts
allowed running (the software is from Opentext called Livelink)- therefore I
need javascript to do the tasks listed below:
1. validate the form - this has been completed
2. pop up another window that will go ahead and confirm the
selections/data - this has been completed.
3. Email the new form data to various users - Not done.
--> I have tried the MAILTO command in the script which I had working,
except there is some sort of line/character limitation that keeps causing
issues.
--> I have thought of calling a perl script from another server, but my
FORM is setup to execute the current server exectuable and the METHOD POST
is allocated to that script (livelink.exe) - is there a way to post for 2
different scripts so that I can run the livelink script and the one on the
remote node?
--> Thought of righting a script that will copy the information to the
clipboard and then to the email body.

--> confused, yeah me to...Basically my worst problem is to create and send
the email automatically (well at least pop up the email with all the data
entered). I have managed to setup the receiver list, Subject and a portion
of the body, but there is apparently to much in the body to work, and it
keeps erroring out.
--> I have also tried taking a script that will create a multi-line text
field in the second window, put the data in there, and copy it to a buffer -
but apparently my management thinks that this might be to much...Therefore I
thought if there is a way that the data from the fields can be copied to a
buffer and when the email window pops up automatcially pasted in that
window....I know confusing...

Anyway below is the code I have so far, hopefully you can get the jest of
what I am trying to accomplish - the main goal is to:
1. have user fill in form
2. 2nd window to pop up with quick summary in it and have user confirm data.
3. submit the data
4. have an email pop up with all the information added, subject,
receiptents, body (with no line/charater limitations).

For the line limitations I had thought that it was do to the fact the line
was to long, then I ran a partial script that put a new line in place after
80 characters.This still failed after - therefore I assume it might be a
mailto limitation...

Code - I have snipped out most of the code to ensure I am not breaking any
"corporate laws" :)
====
var FormIsGood="Yes";
var puHTML_1;
var puHTML_2;
var condition = new Array(100);
var loc_id = new Array(100);
var loc_name = new Array(100);
var conditionCounter;
var locationID;
var locationName;
var formName;
var saveAsName;
var newView;

// Reset variables to initial values
function resetValues(){
FormIsGood="Yes";
puHTML_1="";
puHTML_2="";
condition[0]="Default";
conditionCounter=0;
locationID="";
locationName="";
newView="";
}

// Format a date to the prescribed format
function formatDate(year,month,day){
if (year < 0){year='0000'};
if (month < 0){month=0};
if (day < 0){day=0};
dt=year+"/";
if(month < 10){dt=dt+"0"+(month)+"/"}else{dt=dt+(month)+"/"};
if(day < 10){dt=dt+"0"+day}else{dt=dt+day};
return dt;
}

// Set a date field to a desired date
function setToday(year_field,month_field,day_field,dt){
year_field.value=dt.getFullYear();
month_field.value=dt.getMonth()+1;
day_field.value=dt.getDate();
}

// Get and format the date and time now
function getNow(){
var dt=new Date();
now=dt.getFullYear()+"/";
// Javascript months start at 0 - not 1
if((dt.getMonth()+1) <
10){now=now+"0"+(dt.getMonth()+1)+"/"}else{now=now+(dt.getMonth()+1)+"/"};
if(dt.getDate() <
10){now=now+"0"+dt.getDate()+"-"}else{now=now+dt.getDate()+"-"};
if(dt.getHours() <
10){now=now+"0"+dt.getHours()+"."}else{now=now+dt. getHours()+"."};
if(dt.getMinutes() <
10){now=now+"0"+dt.getMinutes()+"."}else{now=now+d t.getMinutes()+"."};
if(dt.getSeconds() <
10){now=now+"0"+dt.getSeconds()}else{now=now+dt.ge tSeconds()};
return now;
}

// Check for required fields
function required(label, field){
if(field.value.length == 0){
FormIsGood="No";
window.alert(label+' is a required field. Please enter a value for
it.');
}
}

// Add conditions for setting the saved form folder location
function setLocation(text,id,nm){
conditionCounter=conditionCounter+1;
condition[conditionCounter]=text;
loc_id[conditionCounter]=id;
loc_name[conditionCounter]=nm;
}

// Create an HTML string
function addPopupHTML_1(t){
puHTML_1=puHTML_1+t;
}

// Create an HTML string
function addPopupHTML_2(t){
puHTML_2=puHTML_2+t;
}

// Set the default storage location
function setDefaultLocation(id,nm){
condition[0]="Default";
loc_id[0]=id;
loc_name[0]=nm;
}

// Find and set the form storage location
function findLocation(text){
// Set defaults
locationID=loc_id[0];
locationName=loc_name[0];

// Check for a specific location
for (i=0; i<=conditionCounter; i++)
{
if(text==condition[i]){locationID=loc_id[i];locationName=loc_name[i];};
}
}

// Set a new form view upon submission
function setNewView(view){
if (view.length > 0){newView=view;};
}

// Implement the Livelink screen bypass
function openPopup(){
// Determine first save or edit save
s = document.myForm.LL_FUNC_VALUES.value;
index1=0;
index2=9999;

index1=s.indexOf("'func'='")+8;
func=s.substr(index1,index2);

index1=0;
index2=func.indexOf(",")-1;
func=func.substr(index1,index2);

// Submit the Livelink webform
document.myForm.submit();

// For the first save, calculate the form name and display the popup screen,
otherwise, don't
if (func!="Form.SaveForm")
{
// Define the code that is sent to the popup screen
// Define the statement to load the info to the Livelink screen
(opener.document)
folder='opener.document.CreateForm.CTT_ID.value="' +locationID+'";opener.document.CreateForm.CTT_Path Saved.value="'+locationName+'";opener.document.Cre ateForm.CTT_Path.value="'+locationName+'"';

// If a new view has been defined, use it, otherwise use the view that was
used to create the form
if (newView.length >
0){folder=folder+';opener.document.CreateForm.LL_F ormView.value="'+newView+'"';}

// Define the HTML for the popup screen, starting with standard HTML
s='<html><head><title>'+saveAsName+'</title></head><body
onblur="self.focus();"> ';
s=s+"<script> ";

//Begin Display summary script
s=s+' function display_summary(){';
s=s+' var t;';
s=s+' var d;';
s=s+' var label = new Array(100);';
s=s+' var data = new Array(100);';
s=s+' var fieldCounter = 0;';
s=s+' tab="\t";';
s=s+' cr="\n";';

s=s+' // Define the output values';
s=s+' function setField(fieldLabel, fieldData)';
s=s+' {';
s=s+' fieldCounter = fieldCounter + 1;';
s=s+' label[fieldCounter] = fieldLabel;';
s=s+' data[fieldCounter] = fieldData;';
s=s+' }';

s=s+'setField("Name:", "'+document.myForm._1_1_3_1.value+"
"+document.myForm._1_1_4_1.value+");';

s=s+' //do not change anything in this section)*******************';
s=s+' var whole_data ="";';
s=s+' t="";';
s=s+' for (i=1; i<=fieldCounter; i++)';
s=s+' {';
s=s+' whole_data = whole_data + label[i] +cr+
"==========================" +cr+ data[i]+cr+cr;';
s=s+' }';

s=s+'document.summary.data_summary.value = whole_data;';

s=s+'}';
//End Display summary script

s=s+'function doSubmit(){opener.document.CreateForm.name.value =
document.temp.name.value;'+folder+';opener.doSubmi t(opener.document.CreateForm);window.close();}
';
s=s+'function reload(){window.location.reload( false );} ';

s=s+"</"+"script> ";
// Begin user-defined HTML
s=s+puHTML_1;

// Display the form name as HTML and keep the input field hidden
s=s+'<input type="hidden" name="name" value="'+formName+'"
size="90">'+formName+' ';

s=s+puHTML_2;

// End user-defined HTML
// Display the submit button
s=s+'<form name="temp"> ';
s=s+'<p align="center"><button onClick="doSubmit()">Submit
Form</button>&nbsp;&nbsp;<button
onClick="opener.history.go(-2);self.close()">Cancel</button></p> ';
s=s+'</form>';
s=s+'</body></html> ';
// Popup a screen
var att = 'menubar=yes,scrollbars=no,resizable=yes';
var pu = window.open('','pop',att);
pu.window.moveTo(0,0);
pu.window.resizeTo(screen.Width,screen.Height);

// Write the code to the popup screen
pu.document.write(s);

// Refresh the popup screen to force the screen to stay on top of other
windows by activating the onBlur event
pu.reload();
}
}
function definePopupHTML(){

//+++ Change the following addPopupHTML statements as needed.
addPopupHTML_1('<font size="2" face="Arial">This is a summary of what will
be submitted, please click on "O.K." to accept or "Cancel" to cancel this
submission <br>');
addPopupHTML_1('<font size="2" face="Arial"><b><u><br>File will be saved as:
</u></b>');
addPopupHTML_2('<br><font size="2" face="Arial"><ul>');
addPopupHTML_2('<li>Submitters First Name:
'+document.myForm._1_1_3_1.value+'</li>');
addPopupHTML_2('<li>Submitters Last Name:
'+document.myForm._1_1_4_1.value+'</li>');

}

function setLocations(){

//+++ Update define the setDefaultLocation and setLocation statements as
appropriate
setDefaultLocation('2005day','12987962','day');
setLocation('2005month','12987932','Month');

}

// Specify various values
function setValues(){
// Specify the form field that determines the form storage location
// Use "Default" if there is only one possible location

//+++ Update the following statement with the form field or plain text that
specifies the location to save the form
findLocation(document.myForm._1_1_10_1_year.value+ document.myForm._1_1_2_1.value);

// Define the form name. This can be anything or any combination of fixed
text, field values, and dates.
// Use formatDate(year,month,day) function to return a formatted date
// Use the getNow() function to return the current date and time as
formatted text
// Use document.myForm._1_1_6_1.value (use an appropriate field
name/number) to use form field values in the form name

//+++ Update the formName equation to define the form name. You should
include the "Submitted-"+getNow()to ensure no duplicate form names are used.

//Document name is composed of:
formName=document.myForm._1_1_2_1.value+'-'+cust_name+'-'+document.myForm._1_1_9_1.value;

// Define the default name of the file when a user wants to save the
data to their local hard drive.
//+++ Update the following statement
saveAsName=document.myForm._1_1_2_1.value+'-'+cust_name+'-'+document.myForm._1_1_9_1.value;

setNewView("form_ReadOnly");
}

// Validate required fields. If all required fields are OK, then complete
the form submission.
function submitForm(){
// Do not change the following line
resetValues();
//+++ Update, add or remove the required() statements as necessary

//Start of Validation
//=====================

//Ensure the FNAME & LNAME is filled in, even though it is automatic, just
check
//================================================== =============================
required("First Name", document.myForm._1_1_3_1 );
required("Last Name", document.myForm._1_1_4_1 );
// End of all the validation

// Do not change the following lines
setLocations();
setValues();
definePopupHTML();

if (FormIsGood=="Yes"){openPopup()};

}

</javascript>

<FORM TYPE="HIDDEN" NAME="myForm" ACTION="/livelink/livelink.exe"
ENCTYPE="multipart/form-data" METHOD="POST">

....Snip...

<INPUT TYPE="BUTTON" VALUE="Apply" NAME="IgnoreMe" ONCLICK="submitForm();">
Jul 23 '05 #1
2 2865
Mike Button wrote:
Hello all,
Please aim for useful subjects.
I am creating a form that is being run on a server where there is no
scripts allowed running (the software is from Opentext called Livelink)-
therefore I need javascript to do the tasks listed below: 1. validate the form - this has been completed
Undependable
3. Email the new form data to various users - Not done. --> I have tried the MAILTO command in the script which I had working,
except there is some sort of line/character limitation that keeps causing
issues.
http://www.isolani.co.uk/articles/mailto.html
--> I have thought of calling a perl script from another server, but
my
FORM is setup to execute the current server exectuable and the METHOD POST
is allocated to that script (livelink.exe) - is there a way to post for 2
different scripts so that I can run the livelink script and the one on the
remote node?
Not reliably. Write one script that will do both functions. (Or, in a worst
case scenario, have one script do one function, then redirect to the other
script. I suspect this will force you to use the query string to pass data,
which could have nasty consequences)
--> Thought of righting a script that will copy the information to the
clipboard and then to the email body.


Forget it.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2
JRS: In article <Ft********************@rogers.com>, dated Tue, 17 May
2005 00:13:22, seen in news:comp.lang.javascript, Mike Button
<mb*****@nortel.com> posted :
if((dt.getMonth()+1) <
10){now=now+"0"+(dt.getMonth()+1)+"/"}else{now=now+(dt.getMonth()+1)+"/"};
if(dt.getDate() <
10){now=now+"0"+dt.getDate()+"-"}else{now=now+dt.getDate()+"-"};


ISTM that you must be paid, by an incompetent management, per yard of
code.

Those statements can be written as

now += LZ(dt.getMonth()+1) + "/"
now += LZ(dt.getDate()) + "-"

with a suitable function LZ defined - see via below. Not only do you
write getDate thrice, but you execute it twice - and it is of necessity
a comparatively slow function[*].

They can then be reasonably be combined ...

Your problem description was equally indigestible. Do not emulate
Pascal : <URL:http://www.merlyn.demon.co.uk/quotings.htm#Pascal>.

[*] Indeed, in the unlikely event that ECMA / W3 / whoever is reading
this, ISTM that javascript lacks a means of calling for the evaluation,
got a Date Object, of Y M D as Numbers using only one piece of
computation. Or a hint that it would be well to cache any that are
known of Y M D h m s within the Object, since it is common to call for 3
or 6 of them without changing the Object.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: serge calderara | last post by:
Dear all, I need to collect different type of data. Source of those data are CSV files and Access database. I am thinking on the way I should retrive those data under my VB.NET application in...
3
by: EasyRider41 | last post by:
I am trying to merge to scripting samples I for on a source code web site and having limited luck. Then first one is called Zebra Tables witch colors alternate rows of a table to look beter. The...
4
by: GTi | last post by:
What is the best method for doing this: Connection class containing: - Connection handle - Connection name - connection properties - disconnection of connection Group class containing: -...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
36
by: sonnystarks | last post by:
I am trying to learn HTML and have obtained several books on the subject. However, I am confused with the proper way of going about it as most of these books give me the basic tags and then say...
6
by: Carlos Villaseñor M. | last post by:
Hi every body: There are some years that I don´t to practice C++, but since 3 moths when I decide to take up again "C" I encounter that there are 2 versions of "C" (C++ and C#), the first time,...
5
by: Brian | last post by:
Hi All I have 2 question, the first one I hope I don't start an argurment ! How secure is MySQL? I have been asked by a client to create a windows based application that will control /...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
1
by: | last post by:
Hi Database Gurus, Not to start a war among fanatics, but I just wanted to get honest opinion/advise of smart folks like you about this. We are about to begin development for a data intensive web...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.