Help Desk Software & Beyond
October 22, 2017, 08:25:55 AM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: [1] 2 3
  Print  
Author Topic: [REQ] PreDetermined Emails to fill out name field.  (Read 30660 times)
mhequipit
Full Member
***

Karma: 1
Posts: 117


View Profile
« on: February 18, 2008, 07:43:42 PM »

How can I set it up so that I have a certain number of email addresses in a drop down box and then one is selected it will fill the correct name into the Name Field?  I would also like to to select the proper group (which I have labled branch) also.  Is this possible?
« Last Edit: February 18, 2008, 07:48:19 PM by sparky672 » Logged
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #1 on: February 18, 2008, 07:48:01 PM »

Maybe.

I don't have the Group module but the functionality of filling in the name field from the pull-down can be done with Javascript.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
mhequipit
Full Member
***

Karma: 1
Posts: 117


View Profile
« Reply #2 on: February 18, 2008, 07:52:31 PM »

I couldn't find an example, can you point me to one?
Logged
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #3 on: February 18, 2008, 08:16:43 PM »

You can download the code below as an HTML file which you can test in your browser.

http://www.mediafire.com/?3j4d1ejggzp
 

You can and should change the names of the stuff in bold below....

Quote
<html>
<head>

<script language="JavaScript"><!--
function test(){
   document.getElementById('mytextbox').value = document.getElementById('mypulldown').value;
}
//-->
</script>

</head>
<body>

<select name="mypulldown" id="mypulldown" onchange="test()">
<option value="one">1</option>
<option value="two">2</option>
<option value="three">3</option>
<option value="four">4</option>
</select>

<input type="text" name="mytextbox" id="mytextbox" size="32" value="">

</body>
</html>
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
mhequipit
Full Member
***

Karma: 1
Posts: 117


View Profile
« Reply #4 on: February 19, 2008, 07:47:11 AM »

Ok, I want the options to be email addresses (and be used as the email field) and when the email address is selected to fill in the persons name.  How would I use the example to do that?
Logged
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #5 on: February 19, 2008, 08:58:31 AM »

It's expected that you have some basic to intermediate understanding of HTML and Javascript in order to do modifications like this.

The example I created is how you use a pull-down to populate a field with its value.

You're asking the pull-down to do two things and that's a bit more complicated.

Each pull-down option contains ONE value.  It can't be both the name and the email address at the same time.

You'd need another Javascript that would copy the text portion of the pull-down into a hidden field.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
mhequipit
Full Member
***

Karma: 1
Posts: 117


View Profile
« Reply #6 on: February 19, 2008, 09:12:22 AM »

Ok, first of all I do understand HTML, but not the javascript.  My boss wants some unrealistic things to happen with this piece of software.  I told him that I may be able to use PHP to do them, and then I see it's not compatible with PHP.  I will tell him I need some javascript training and see what happens.
Logged
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #7 on: February 19, 2008, 09:44:05 AM »

I'm just a volunteer here so I can't be expected to provide individual full solutions from start to finish....  from the previous questions, I took that to be the expectation.

Just give me some time and I can help a little more.  Adding the hidden field and a couple lines to the function won't be a huge undertaking.  No worries.

If you understand PHP, you shouldn't have too much trouble with the Javascript.

But basically, you're replacing the existing form fields with the ones provided in the example.  The critical piece that makes the replacement field valid in TTX would be the { name= } attribute in the HTML field.  For example, if TTX is looking at { name="xPhoneNumber" } attribute, then your replacement field would have to contain the same value for name.

Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #8 on: February 19, 2008, 02:16:14 PM »

Try these modifications to your newticket.html template....

Add this new Javascript to the top...

Quote
<script language="JavaScript"><!--
function updatefields(){
   document.getElementById('name').value = document.getElementById('mypulldown').value;
   document.getElementById('email').value = document.getElementById('mypulldown').text;
}
//-->
</script>

remove the TTX name and email fields from the form and add these three items...

Quote
<input type="text" name="name" id="name" size="32" value="">

<select name="mypulldown" id="mypulldown" onchange="updatefields()">
<option value="name 1">email address 1</option>
<option value="name 2">email address 2</option>
<option value="name 3">email address 3</option>
<option value="name 4">email address 4</option>
</select>

<input type="hidden" name="email" id="email">

The above will allow you to choose an email address from a pull down which will fill out the name field on the form automatically.  Both the selected email address and name will get submitted with the form.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
mhequipit
Full Member
***

Karma: 1
Posts: 117


View Profile
« Reply #9 on: February 19, 2008, 02:39:54 PM »

That is awsome.  I did that, and when I submit the form I get red invalid email at the top.  Any ideas?  I do appreciate your help and will get getting a javascript book tonight!
Logged
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #10 on: February 19, 2008, 02:46:09 PM »

oops...

try this hidden field instead.... I forgot the blank { value="" } before...

Quote
<input type="hidden" name="email" id="email" value="">

You can install Firefox and use the Javascript Error console to get detailed troubleshooting information.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
mhequipit
Full Member
***

Karma: 1
Posts: 117


View Profile
« Reply #11 on: February 19, 2008, 02:49:48 PM »

Same error but the error console tells us that onlyonce is not defined?
Logged
Sparky
Moderator
Hero Member
*****

Karma: 85
Posts: 2,275


stop pushing all those buttons


View Profile
« Reply #12 on: February 19, 2008, 02:57:18 PM »

"onlyonce" is not part of any code I posted here so you'll have to find and fix that.

However, it's very possible that Javascript error is stopping the other Javascript on the page from properly executing.

Did you put properly formatted email addresses into the pull-down menu yet?  TTX validates the format of the email value and will give an error if it's not right.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
mhequipit
Full Member
***

Karma: 1
Posts: 117


View Profile
« Reply #13 on: February 19, 2008, 03:03:53 PM »

Here's the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta name="Description" content="Information architecture, Web Design, Web Standards." />
<meta name="Keywords" content="MH, service, equipment, hyster, yale" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="Distribution" content="Global" />
<meta name="Author" content="Willie Howe - williehowe@gmail.com" />
<meta name="Robots" content="index,follow" />

<link rel="stylesheet" href="http://resales.mhequipment.com/Refresh.css" type="text/css" />

<title>MH Equipment - ReSales</title>
<script type="text/javascript"><!--
function updatefields(){
   document.getElementById('name').value = document.getElementById('mypulldown').value;
   document.getElementById('email').value = document.getElementById('mypulldown').text;
}
//-->
</script>
   
</head>

<body>
<!-- wrap starts here -->
<div id="wrap">
      
      <!--header -->
      <div id="header">         
            
         
            
         
            
   </div>
      
      <!-- menu -->   
      <div  id="menu">
         &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;<font color="white"></font>
      </div>               
         
      <!-- content-wrap starts here -->
      <div id="content-wrap">
            
         <div id="sidebar">
               
            <h1>Links</h1>
            <div class="left-box">
               <ul class="sidemenu">
                  <li><a href="(%ENV_SCRIPT_NAME%)?cmd=(%HELPDESKCMD%)&sid=(%INPUT_sid%)&style=(%INPUT_style%)">[%Tickets%]</a></li>   
                  <li>(%LOGINLOGOUT%)</li>
<li><a href="(%ENV_SCRIPT_NAME%)?cmd=newticket">[%Contact us%]</a></li>
                  
                     
               </ul>   
            </div>
         
            
            
            
            
            
                     
            
         </div>
            
         <div id="main">
            
            <a name="TemplateInfo"></a>
            <h1><font color="black">Ticket Request</h1></font>
<br>
<form method=post action="(%ENV_SCRIPT_NAME%)" name=newticket enctype="multipart/form-data" onsubmit="return onlyonce()">
<input type=hidden name=cmd value=newticket>
<input type=hidden name=style value="(%INPUT_style%)">
<input type=hidden name=sid value=(%INPUT_sid%)>
<input type=hidden name=do value=1>
<input type=hidden name=tid value=(%INPUT_tid%)>
<input type=hidden name=form value=(%INPUT_form%)>
<input type=hidden name=email id=email value="">
      <table cellspacing=0 cellpadding=3>
      <tr>
        <td align=right class=lbl>[%Email%]</td>
        <td align=left><select name="mypulldown" id="mypulldown" onchange="updatefields()">
<option value="Willie Howe">whowe@mhequipment.com</option>
<option value="Justin Michels">jmichels@mhequipment.com</option>
<option value="Mark Miller">mmiller@mhequipment.com</option>
<option value="Steve Dahlhauser">sdahlhauser@mhequipment.com</option>
</select></td>
      </tr>
      <tr>
        <td align=right class-lbl>[%Name%]</td>
        <td align=left><input type="text" name="name" id="name" size="32" value=""></td>
      </tr>

      (%CUSTOMVARS%)
      (%ITEMSELSTD%)
      (%OPERSELSTD%)
      (%GROUPSELSTD%)

      <tr>
        <td align=right class=lbl>[%ReSale Manager Name%]<font color=red><sup>*</sup></font></td>
        <td align=left><input type=text size=40 name=subject value="(%INPUT_subject%)"></td>
      </tr>
      (%KIDFORM%)
      <tr>
        <td colspan=2 align=center>
           <table cellspacing=0 cellpadding=0>
              <tr><br><br><br>
                <td align=left bgcolor="#FFCC77">
                  <span class=lbl>[%Truck Options / Notes%]</span>&nbsp;&nbsp;&nbsp;<br class=tiny>
                  <textarea name=problem wrap=virtual cols=50 rows=10>(%INPUT_problem%)</textarea>
                </td>
              </tr>
           </table>
        </td>
      </tr>
      <tr><td colspan=2 align=left>(%FILEFORMS%)</td></tr>
      <tr>
        <td align=left>(%INTERNALCHECKBOX%)</td>
        <td align=right><input type=submit value="[%Submit%]"><br><br class=tiny></td>
      </tr>
</form>
      </table>
    </td>
  </tr>
</table>
<form method="post" action="(%ENV_SCRIPT_NAME%)" id="preview" target="winpreview" >
<input type=hidden name=cmd value=preview>
<input type=hidden name=style value="(%INPUT_style%)">
<input type=hidden name=sid value=(%INPUT_sid%)>
<input type=hidden name=key value=(%INPUT_key%)>
<input type=hidden name=msg>
</form>
<br>
<font color=red><sup>*</sup></font> = Required Field

            
             

            
      
            
            
            
         
            
            
            
                        
               
            
            
         
               
                     
                        
            
                     
            
            
            
            
                        
            
            
            

         </div>
      
      <!-- content-wrap ends here -->   
      </div>
               
      <!--footer starts here-->
      <div id="footer">
         
         <p>
         &copy; 2007 <strong>MH Equipment Company</strong>
         </p>
            
      </div>   

<!-- wrap ends here -->
</div>

</body>
</html>
Logged
mhequipit
Full Member
***

Karma: 1
Posts: 117


View Profile
« Reply #14 on: February 19, 2008, 03:04:51 PM »

Are those formatted the way ttx likes them?  I looked on my other test system and i get the same error in the error console, so I think this is ttx for sure.
Logged
Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.034 seconds with 20 queries.