PDA

View Full Version : multiple onclicks with submit button



hotmonkeyac
08-19-2006, 06:02 PM
ok...here's the background of what this code needs to do... basically, you fill in the forms and hit submit and it will email out the required info. the problem is, you cannot use spaces when creating an email link...so the code has to first take out the spaces and convert them to %20 ...then second generate the email link....here's the WORKING code...however, is there a way to combine both buttons into one? here's the code:


<html><head><title></title>

<SCRIPT LANGUAGE="JavaScript">

function WriteIt (ears) {
ears.result.value = document.write("<a href=mailto:test@test.com?subject=EARS%20SENT%20-%20Ticket#%20"
+ears.ticketnumberout.value+"&amp;body=A%20Severity%20One%20issue%20was%20reported%20at%20"+ears.timeout.value
+"%20on%20"+ears.dateout.value+"%0dApplication%20Affected%20is:%20"+ears.appout.value
+"%0dFacility%20impacted%20by%20this%20outage%20is:%20"+ears.facilityout.value+"%0dArea%20impacted%20is:%20"
+ears.areaout.value+"%0dEstimated%20Time%20of%20Resolution%20is:%20"+ears.etaout.value
+"%0dTicket%20number%20associated%20with%20this%20Incident%20is%20ticket%20number%20"
+ears.ticketnumberout.value+"%0d%0dThank%20You>Click here to send an email.</a>"
)
}

</SCRIPT>




<script language="JavaScript">


function runWebify(form) {
form.timeout.value = (escape(form.time.value));
form.dateout.value = (escape(form.date.value));
form.appout.value = (escape(form.app.value));
form.facilityout.value = (escape(form.facility.value));
form.areaout.value = (escape(form.area.value));
form.etaout.value = (escape(form.eta.value));
form.ticketnumberout.value = (escape(form.ticketnumber.value));
return;
}


</script></head><body>
<p>


</p><form name="Test">

<FORM>
<TABLE CELLPADDING="5">
<TR><TD>Time:</TD><TD><INPUT TYPE=text NAME="time"></TD></TR>
<TR><TD>Date:</TD><TD><INPUT TYPE=text NAME="date"></TD></TR>
<TR><TD>Application Affected:</TD><TD><INPUT TYPE=text NAME="app"></TD></TR>
<TR><TD>Facility Affected:</TD><TD><INPUT TYPE=text NAME="facility"></TD></TR>
<TR><TD>Area Affected:</TD><TD><INPUT TYPE=text NAME="area"></TD></TR>
<TR><TD>ETA:</TD><TD><INPUT TYPE=text NAME="eta"></TD></TR>
<TR><TD>Ticket Number:</TD><TD><INPUT TYPE=text NAME="ticketnumber"></TD></TR>
</TABLE>

<input name="test" value="Click here 1st" onclick="runWebify(this.form);" type="button">&nbsp; <INPUT TYPE="button" VALUE="Click here 2nd" onClick="WriteIt(this.form)">&nbsp;
<INPUT TYPE="reset" VALUE="Clear">
<P><INPUT TYPE="hidden" NAME="result">

<FORM>
<TABLE CELLPADDING="5">
<TR><TD></TD><TD><INPUT TYPE=text NAME="timeout"></TD></TR>
<TR><TD></TD><TD><INPUT TYPE=text NAME="dateout"></TD></TR>
<TR><TD></TD><TD><INPUT TYPE=text NAME="appout"></TD></TR>
<TR><TD></TD><TD><INPUT TYPE=text NAME="facilityout"></TD></TR>
<TR><TD></TD><TD><INPUT TYPE=text NAME="areaout"></TD></TR>
<TR><TD></TD><TD><INPUT TYPE=text NAME="etaout"></TD></TR>
<TR><TD></TD><TD><INPUT TYPE=text NAME="ticketnumberout"></TD></TR>
</TABLE>

</FORM>
</TD>
</TR>
</TABLE>
</P>

Any ideas? Or is it just easier to use a form mailer? (do they even make javascript form mailers?) Thanks! I've been stuck for hours!

DimX
08-19-2006, 06:15 PM
onclick="runWebify(this.form); WriteIt(this.form)"
;)

hotmonkeyac
08-19-2006, 06:24 PM
DimX,

I tried that, but no luck....

I also tried
onclick="myownfunction();"

and then created a function at the top:


function myownfunction() {
unWebify(this.form);
WriteIt(this.form);
}


But no luck. Any other suggestions?

hotmonkeyac
08-19-2006, 06:53 PM
Nevermind. got it!

DimX
08-19-2006, 06:54 PM
document.ears.value = document.write("...") <-- what's that??? document.write() returns undefined anyway, doesn't it?
------------
Edit: Do'h