Results 1 to 5 of 5

Thread: multiple onclicks with submit button

  1. #1
    Join Date
    Aug 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default multiple onclicks with submit button

    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:

    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!

  2. #2
    Join Date
    Jun 2006
    Posts
    182
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default

    Code:
    onclick="runWebify(this.form); WriteIt(this.form)"

  3. #3
    Join Date
    Aug 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    DimX,

    I tried that, but no luck....

    I also tried
    Code:
    onclick="myownfunction();"
    and then created a function at the top:

    Code:
    function myownfunction() {
    unWebify(this.form);
    WriteIt(this.form);
    }
    But no luck. Any other suggestions?

  4. #4
    Join Date
    Aug 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Nevermind. got it!

  5. #5
    Join Date
    Jun 2006
    Posts
    182
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default

    document.ears.value = document.write("...") <-- what's that??? document.write() returns undefined anyway, doesn't it?
    ------------
    Edit: Do'h

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •