• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4509
  • Last Modified:

Trim Value/Field length before search

hi,

I' got this Database which is displayed by ASP. I have a search part, but i need to trim the values of the field.

eg values

srut-fe
tsf-fe
jifj-mprn
fjkdj-mprm
dsds-vpn
dsd-fddi

i need to trim/cut off the "-fe/-mprn/-vpn etc.

so basically i require to cut off the "-" and whats after it.

here my search part.

<form onSubmit="return EW_checkMyForm(this);"  action="data_validationlist.asp" method="get" name= "myform3">


<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;</font></p>

<input type="hidden" name="x_Client" value="<%= x_Client %>" >&nbsp;

<A href='javascript:document.myform3.submit();'>
<IMG src = "images/data_validation_button2.jpg" border = "0" title = "Click here to view the Data Validation Certificate for this client"> </a>
</form>

----

x_Client is the value with the -fe/-mprn etc.

can any one help?

0
Robson8112
Asked:
Robson8112
  • 16
  • 13
  • +1
1 Solution
 
avnerCommented:
This method will remove the end part :

function TrimSpecial(str)
{
var re = /-fe|-mpm|-vpn/gi;
          return str.replace(re, "")
}



a running example :

<html>
<head>
<title>abot:blank</title>
<script language="javascript1.2">
<!-- avcoh@yahoo.com

function TrimSpecial(str)
{
var re = /-fe|-mpm|-vpn/gi;
          return str.replace(re, "")
}

var s = TrimSpecial("111-fe");
alert(s)
var s = TrimSpecial("222-mpm");
alert(s)
var s = TrimSpecial("333-vpn");
alert(s)

-->
</script>
<style>

</style>
</head>
<body>

</body>
</html>
0
 
Robson8112Author Commented:

I've tried it and it doesnt work

Do i not point it to x_clients, so it knows where to remove the -fe or -mprn etc ?
0
 
avnerCommented:
It works as you can see from the example, probably the implementation with the method is not working.

You will have to post the complete code so I can see where you went wrong.

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Robson8112Author Commented:
<% if Session("cwnaosat_status") <> "login" then response.redirect "login.asp" %>
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<!--#include file="db.asp"-->

<%
response.buffer = true

'get key
key = request.querystring("key")
if key="" or isnull(key) then
      key=request.form("key")
end if
if key="" or isnull(key) then response.redirect "clientslist.asp"

'get action
a=request.form("a")
if a="" or isnull(a) then
      a="I"      'display with input box
end if

' Open Connection to the database
set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str

Select Case a
      Case "I": ' Get a record to display

            tkey = "'" & replace(replace(key & "","'","''"),"[","[[]") & "'"
            strsql = "SELECT * FROM [clients] WHERE [ID]=" & tkey

            set rs = Server.CreateObject("ADODB.Recordset")
            rs.Open strsql, conn
            If rs.EOF Then
                  Response.Clear
                  Response.Redirect "clientslist.asp"
            Else
                  rs.MoveFirst
            End If

            ' Get the field contents
            x_Client = rs("Client")
            x_Client_IP = rs("Client IP")
            x_Hardware = rs("Hardware")
            x_Media_Server = rs("Media Server")
            x_OS = rs("OS")
            x_Oracle_Backup = rs("Oracle Backup")
            x_OS_Backup = rs("OS Backup")
            x_Terminal_Emulation = rs("Terminal Emulation")
            x_Notes = rs("Notes")
            x_Known_Supportal = rs("Known Supportal")

            
            rs.Close
            Set rs = Nothing

End Select
%>


<p align="center"><u><b><font color="#000080" face="Arial" size="3">Clients View</font></b></u><font face="Arial" size="2"><br><br><a href="clientslist.asp">Back to List</a></font></p>


<p align="center">
<form>
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">

<tr>
<td bgcolor="#430066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">Client</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"><% response.write x_Client %></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">IP</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"><% response.write x_IP %></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Master/Media Server </font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"><% response.write x_Media_Server %></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Hardware</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"><% response.write x_Hardware %></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">OS</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"><% response.write x_OS %></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Terminal Emulation</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"><% response.write x_Terminal_Emulation %></font>&nbsp;</p>
</td>
</tr>



<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Oracle Backup </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"><% response.write x_Oracle_Backup %></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">On Supportal </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"><% response.write x_Known_Supportal %></font>&nbsp;</p>
</td>
</tr>


<tr>
<td bgcolor="#330066">
  <p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Notes</font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
  <p align="center"><font face="Arial" size="2"><% response.write x_Notes %></font>&nbsp;</p>
</td>
</tr>

</table>
</form>
<p>


<script language="JavaScript" src="ew.js"></script>
<p align="center">


<script language="JavaScript">
<!-- start Javascript
function  EW_checkMyForm(EW_this) {
return true;
}



// end JavaScript -->
</script>


</script>

<form onSubmit="return EW_checkMyForm(this);"  action="changeslist.asp" method="get" name = "myform">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;
<p align="center">
<input type="hidden" name="x_Client" value="<%= x_Client %>" size=30 maxlength=60>&nbsp;
<A href='javascript:document.myform.submit();'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>

</form>


<form onSubmit="return EW_checkMyForm(this);"  action="problemslist.asp" method="get" name = "myform2">
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;</font></p>
<p align="center">
<input type="hidden" name="x_Client" value="<%= x_Client %>" size=30 maxlength=60>&nbsp;
<A href='javascript:document.myform2.submit();'><IMG src = "images/problems_associated_button.jpg" border = "0" title = "Click here to view Problems associated with this client"> </a>


</form>

<form onSubmit="return EW_checkMyForm(this);"  action="data_validationlist.asp" method="get" name = "myform3">
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;</font></p>
<p align="center">
<input type="hidden" name="x_Client" value="<%= x_Client %>" size=30 maxlength=60>&nbsp;

<A href='javascript:document.myform3.submit();'><IMG src = "images/data_validation_button2.jpg" border = "0" title = "Click here to view the Data Validation Certificate for this client"> </a>
</form>



<!--#include file="footer.asp"-->
<p>&nbsp;</p>





0
 
Robson8112Author Commented:
sorry i removed the code what u gave me!

if yours is right, please tell me where to put it!

Thanks
0
 
avnerCommented:
My code is a JavaScript code, that is client side, what you posted is the ASP page, that is server side. What I need is the output page (the HTML) generated by IIS.
0
 
Robson8112Author Commented:
hope this is what u need (HTML of the page)



<p align="center"><u><b><font color="#000080" face="Arial" size="3">Clients View</font></b></u><font face="Arial" size="2"><br><br><a href="clientslist.asp">Back to List</a></font></p>


<p align="center">
<form>
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">

<tr>
<td bgcolor="#430066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">Client</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">aspasea1-vpn</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">IP</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Master/Media Server </font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">Byadsm01</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Hardware</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">HP9000-800</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">OS</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">HP-UX10.20</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Terminal Emulation</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>



<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Oracle Backup </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">On Supportal </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">Yes</font>&nbsp;</p>
</td>
</tr>


<tr>
<td bgcolor="#330066">
  <p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Notes</font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
  <p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

</table>
</form>
<p>


<script language="JavaScript" src="ew.js"></script>
<p align="center">


<script language="JavaScript">
<!-- start Javascript
function  EW_checkMyForm(EW_this) {
return true;
}



// end JavaScript -->
</script>


<script language="JavaScript">
function TrimSpecial(str)
{
var x_Client = /-fe|-mprn|-vpn/gi;
         return str.replace(x_Client, "")
}

</script>

<form onSubmit="return EW_checkMyForm(this);"  action="changeslist.asp" method="get" name = "myform">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;
<p align="center">
<input type="hidden" name="x_Client" value="aspasea1-vpn" size=30 maxlength=60>&nbsp;
<A href='javascript:document.myform.submit();'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>

</form>


<form onSubmit="return EW_checkMyForm(this);"  action="problemslist.asp" method="get" name = "myform2">
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;</font></p>
<p align="center">
<input type="hidden" name="x_Client" value="aspasea1-vpn" size=30 maxlength=60>&nbsp;
<A href='javascript:document.myform2.submit();'><IMG src = "images/problems_associated_button.jpg" border = "0" title = "Click here to view Problems associated with this client"> </a>


</form>

<form onSubmit="return EW_checkMyForm(this);"  action="data_validationlist.asp" method="get" name = "myform3">
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;</font></p>
<p align="center">
<input type="hidden" name="x_Client" value="aspasea1-vpn" size=30 maxlength=60>&nbsp;

<A href='javascript:document.myform3.submit();'><IMG src = "images/data_validation_button2.jpg" border = "0" title = "Click here to view the Data Validation Certificate for this client"> </a>
</form>



 


<p>&nbsp;</p>






0
 
avnerCommented:
Ok, You added the method but you have not used it.

When exactly do you want this trimmed string to be send to , how and when ?

0
 
Robson8112Author Commented:
i would like it to be trimmed before, the search, not at the top, beacause im displaying the full name of the client.


<form onSubmit="return EW_checkMyForm(this);"  action="changeslist.asp" method="get" name = "myform">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;
<p align="center">
<input type="hidden" name="x_Client" value="aspasea1-vpn" size=30 maxlength=60>&nbsp;
<A href='javascript:document.myform.submit();'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>

</form>
0
 
Robson8112Author Commented:
as u can see here:

<input type="hidden" name="x_Client" value="aspasea1-vpn" size=30 maxlength=60>&nbsp

aspasea1-vpn is one of the clients i clicked to view, so its that value i want the -vpn removing from before i submit.
0
 
avnerCommented:
The thing is this , the HTML is a complete mess.

This is the fixed HTML , but you will have to fix the ASP according to this HTML. every  open TAG should be closed, the hidden INPUT fileds should be a direct childrens of the form element :

<p align="center"><u><b><font color="#000080" face="Arial" size="3">Clients View</font></b></u><font face="Arial" size="2"><br><br><a href="clientslist.asp">Back to List</a></font></p>


<p align="center">
<form>
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">

<tr>
<td bgcolor="#430066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">Client</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">aspasea1-vpn</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">IP</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Master/Media Server </font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">Byadsm01</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Hardware</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">HP9000-800</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">OS</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">HP-UX10.20</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Terminal Emulation</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>



<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Oracle Backup </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">On Supportal </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">Yes</font>&nbsp;</p>
</td>
</tr>


<tr>
<td bgcolor="#330066">
 <p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Notes</font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
 <p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

</table>
</form>
<p>


<script language="JavaScript" src="ew.js"></script>
<p align="center">


<script language="JavaScript">
<!-- start Javascript
function  submitForm(sForm) {
var oForm = document.forms[sForm]
var  re = /-fe|-mprn|-vpn/gi;
oForm.children["x_Client"].value =  oForm.children["x_Client"].value.replace(re, "")
oForm.submit();
}

// end JavaScript -->
</script>

<form action="changeslist.asp" method="get" name = "myform">
      <input type="hidden" name="z_Client" value="LIKE,'%,%'">
      <input type="hidden" name="x_Client" value="aspasea1-vpn" size=30 maxlength=60>
      <p align="center">

      <A href='javascript:submitForm("myform")'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>

</form>


<form action="problemslist.asp" method="get" name = "myform2">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">
<input type="hidden" name="x_Client" value="aspasea1-vpn" size=30 maxlength=60>
<p align="center">

<A href='javascript:submitForm("myForm2")'><IMG src = "images/problems_associated_button.jpg" border = "0" title = "Click here to view Problems associated with this client"> </a>


</form>

<form action="data_validationlist.asp" method="get" name = "myform3">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">
<input type="hidden" name="x_Client" value="aspasea1-vpn" size=30 maxlength=60>&nbsp;
<p align="center">


<A href='javascript:submitForm("myform3")'><IMG src = "images/data_validation_button2.jpg" border = "0" title = "Click here to view the Data Validation Certificate for this client"> </a>
</form>






<p>&nbsp;</p>
0
 
Robson8112Author Commented:
which tags am i missing?  I've put the script in but is still doesnt remove the -fe etc

<script language="JavaScript">
<!-- start Javascript
function  submitForm(sForm) {
var oForm = document.forms[sForm]
var  re = /-fe|-mprn|-vpn/gi;
oForm.children["x_Client"].value =  oForm.children["x_Client"].value.replace(re, "")
oForm.submit();
}

// end JavaScript -->
</script>

<form onSubmit="return EW_checkMyForm(this);"  action="changeslist.asp" method="get" name = "myform">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;
<p align="center">
<input type="hidden" name="x_Client" value="dyespp1-fe" size=30 maxlength=60>&nbsp;
<A href='javascript:document.myform.submit();'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>

</form>
0
 
mbochniakCommented:
Try running the value of the field through this before submitting:

function GetPrefix(strValue){
if (!strValue.test(/(\w+)[-]\w+/g)) return strValue;
var bMatch = strValue.match(/(\w+)[-]\w+/);
return bMatch[1];
}

If the function finds a match to the pattern "(some characters) - (some characters)" it will return the characters before the "-", otherwise it will return the full full passed value.

Good Luck!

Mike
0
 
jonnalCommented:
hi
str= str.split('-')[0];
0
 
avnerCommented:
Here is the fixed code.
<script language="JavaScript">
<!-- start Javascript
function  submitForm(sForm) {
var oForm = document.forms[sForm]
var  re = /-fe|-mprn|-vpn/gi;
oForm.children["x_Client"].value =  oForm.children["x_Client"].value.replace(re, "")
oForm.submit();
}

// end JavaScript -->
</script>

<form onSubmit="return EW_checkMyForm(this);"  action="changeslist.asp" method="get" name = "myform">
<input type="hidden" name="x_Client" value="dyespp1-fe" size=30 maxlength=60>&nbsp;
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;
<p align="center">

<A href='javascript:submitForm("myform");'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>

</form>

1. The hidden input must be a direct child of the FORM element.
2. Notice the <A href="javascript.... "/>   , I'm using a method to submit the form, this method cleans the value of x_Client.
0
 
Robson8112Author Commented:
If the value of x_Client is going to be cleaned, then doesnt that mean a "blank" value will be passed?
0
 
avnerCommented:
What do you mean by :"If the value of x_Client is going to be cleaned"
Why do you think it is being cleaned ?
0
 
Robson8112Author Commented:
From what you noted at the bottom of your last comment

"I'm using a method to submit the form, this method cleans the value of x_Client"
0
 
avnerCommented:
When I wrote "cleans" I meant "parsing" , sorry if I wasn't clear enough.
0
 
Robson8112Author Commented:
oh sorry, mis understood you,

I've tried the code, but still no joy!

im not sure i understand "direct child of the FORM element"
0
 
avnerCommented:
>direct child of the FORM element

<FORM>
<INPUT type="HIDDEN"></INPUT>
</FORM>


That is FORM and the direct child INPUT

and not :
<FORM>
<p>
<INPUT type="HIDDEN"></INPUT>
</p>
</FORM>

in this case the INPUT is a child of the "p" element.

What is the problem now ? (post the HTML output, i will look into it.)

0
 
Robson8112Author Commented:
<p align="center"><u><b><font color="#000080" face="Arial" size="3">Clients View</font></b></u><font face="Arial" size="2"><br><br><a href="clientslist.asp">Back to List</a></font></p>


<p align="center">
<form>
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">

<tr>
<td bgcolor="#430066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">Client</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">dyespp1-fe</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">IP</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Master/Media Server </font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">Dyadsm01</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Hardware</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">HP9000-800</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">OS</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">HP-UX11.00</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Terminal Emulation</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>



<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Oracle Backup </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">On Supportal </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>


<tr>
<td bgcolor="#330066">
  <p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Notes</font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
  <p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

</table>
</form>
<p>


<script language="JavaScript" src="ew.js"></script>
<p align="center">


<script language="JavaScript">
<!-- start Javascript
function  EW_checkMyForm(EW_this) {
return true;
}
// end JavaScript -->
</script>






<script language="JavaScript" src="ew.js"></script>
<p align="center">


<script language="JavaScript">
<!-- start Javascript
function  submitForm(sForm) {
var oForm = document.forms[sForm]
var  re = /-fe|-mprn|-vpn/gi;
oForm.children["x_Client"].value =  oForm.children["x_Client"].value.replace(re, "")
oForm.submit();
}

// end JavaScript -->
</script>


<form onSubmit="return EW_checkMyForm(this);"  action="changeslist.asp" method="get" name = "myform">
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;
<input type="hidden" name="x_Client" value="dyespp1-fe" size=30 maxlength=60>&nbsp;
<A href='javascript:document.myform.submit();'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>
</form>


<form onSubmit="return EW_checkMyForm(this);"  action="problemslist.asp" method="get" name = "myform2">
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;</font></p>
<p align="center">
<input type="hidden" name="x_Client" value="dyespp1-fe" size=30 maxlength=60>&nbsp;
<A href='javascript:document.myform2.submit();'><IMG src = "images/problems_associated_button.jpg" border = "0" title = "Click here to view Problems associated with this client"> </a>


</form>

<form onSubmit="return EW_checkMyForm(this);"  action="data_validationlist.asp" method="get" name = "myform3">
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;</font></p>
<p align="center">
<input type="hidden" name="x_Client" value="dyespp1-fe" size=30 maxlength=60>&nbsp;

<A href='javascript:document.myform3.submit();'><IMG src = "images/data_validation_button2.jpg" border = "0" title = "Click here to view the Data Validation Certificate for this client"> </a>
</form>
0
 
avnerCommented:
You have still not updated the HTML to output correctly.
Look at the HTML I posted before you need to change all the elements so that the ouput will be exactly as my input.
For example :

1. All onSubmit="return EW_checkMyForm(this);"   should be removed.
2. <input type="hidden" name="x_Client" value="dyespp1-fe" size=30 maxlength=60> should eb right under the <form> tag.
3. <A href='javascript:document.myform3.submit();'>< should be changed to <A href='javascript:submitForm('myform')'> where 'myform' is the current form name as appears in the FORM tag.
0
 
Robson8112Author Commented:
ok, its now failing. is the <A href='javascript:submitForm('myform3')' correct??


<script language="JavaScript">
<!-- start Javascript
function  submitForm(sForm) {
var oForm = document.forms[sForm]
var  re = /-fe|-mprn|-vpn/gi;
oForm.children["x_Client"].value =  oForm.children["x_Client"].value.replace(re, "")
oForm.submit();
}

// end JavaScript -->
</script>


<form action="changeslist.asp" method="get" name = "myform">
<input type="hidden" name="x_Client" value="<%= x_Client %>" size=30 maxlength=60>&nbsp;
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;
<A href='javascript:submitForm('myform3')'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>

</p>
</form>
0
 
avnerCommented:
NO.
Look at the "name" attribute of the "form" tag :
<form action="changeslist.asp" method="get" name = "myform">

the name is "myform" so the href should be :
<A href='javascript:submitForm('myform')'
0
 
Robson8112Author Commented:
i know, i realised thats after i posted my code up and changed it after,

However, it still fails
0
 
Robson8112Author Commented:
there something wrong with

<A href='javascript:submitForm('myform')'>
0
 
avnerCommented:
I have runned this code on my machine and is working fine, try to post the full code and I'll tell you where is the problem.

0
 
Robson8112Author Commented:



<p align="center"><u><b><font color="#000080" face="Arial" size="3">Clients View</font></b></u><font face="Arial" size="2"><br><br><a href="clientslist.asp">Back to List</a></font></p>


<p align="center">
<form>
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">

<tr>
<td bgcolor="#430066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">Client</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">dyemw09-fe</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#CCFFFF"><font face="Arial" size="2">IP</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Master/Media Server </font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">Dyadsm01</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Hardware</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">Solaris</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">OS</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2">Solaris8</font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Terminal Emulation</font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>



<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Oracle Backup </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

<tr>
<td bgcolor="#330066">
<p align="center"><font color="#FFFFFF"><font face="Arial" size="2">On Supportal </font></font></p>
</td>
<td bgcolor="#F5F5F5">
<p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>


<tr>
<td bgcolor="#330066">
  <p align="center"><font color="#FFFFFF"><font face="Arial" size="2">Notes</font>&nbsp;</font></p>
</td>
<td bgcolor="#F5F5F5">
  <p align="center"><font face="Arial" size="2"></font>&nbsp;</p>
</td>
</tr>

</table>
</form>
<p>


<script language="JavaScript" src="ew.js"></script>
<p align="center">









<script language="JavaScript" src="ew.js"></script>
<p align="center">


<script language="JavaScript">
<!-- start Javascript
function  submitForm(sForm) {
var oForm = document.forms[sForm]
var  re = /-fe|-mprn|-vpn/gi;
oForm.children["x_Client"].value =  oForm.children["x_Client"].value.replace(re, "")
oForm.submit();
}

// end JavaScript -->
</script>


<form  action="changeslist.asp" method="get" name = "myform">
<input type="hidden" name="x_Client" value="dyemw09-fe" size=30 maxlength=60>&nbsp;
<p align="center">
<input type="hidden" name="z_Client" value="LIKE,'%,%'">&nbsp;
<A href='javascript:submitForm('myform')'><IMG src = "images/changes_associated_button.jpg" border = "0" title = "Click to view changes associated with this client"></a>

</p>
</form>
0
 
avnerCommented:
Your problem is now qoutes, ' can not be inside ' so :

<A href='javascript:submitForm('myform')'>
should actually be :
<A href='javascript:submitForm("myform")'>

0
 
Robson8112Author Commented:
Woooo hooo..  at last!

Thanks you very much, and thanks again for your patience!

25 points in your bag!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 16
  • 13
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now