SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help with simple problem

    i have around 6 var "256-512-1M.. and so on" which store in my database as value like "1-2-3 .. and so on"
    i want the requirment

    if the value "1" turn or appear 256

    if value "2" // // // 512

    if value "3" // // // 1M

    i try to solve more time but i failed

    plz help me
    Thx in advence
    Last edited by judge0; Sep 3, 2008 at 17:39.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,678
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    It's very vague what is being asked for, so here's how to use a select box to let someone select a meaningful name, and submit with the form a different value.

    Code html4strict:
    <select name="memory">
        <option value="1">256</option>
        <option value="2">512</option>
        <option value="3">1M</option>
    </select>
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i m working with Windows CRM3 and i want to make page search in my CRM

    database but i face problem that crm store this data"256-512-1M"as value

    "1-2-3" and when i made connect with this database this field appear as it in

    database"1-2-3" and this cause problem with who dealing this search page

    cant understand which this value refer to

    The requirment: i went when the value appear turn to understood word like 256-512-1M and so

    Mean

    if the value "1" turn or appear 256

    if value "2" // // // 512

    if value "3" // // // 1M

    i hope u get clear image for the case and some mystifications disappeared.

    Thx in advence

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,678
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    I strongly suspect that javascript is not going to be the solution for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ammm

    but why u say that

    my search page work successfully as i want but only the problem is this value which i think i can work around it in my client side by using javascript by make an array with this var or somthing else .....

    , any way if u right plz what's ur suggestions

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,678
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    It seems that the problem is with the server-side end of things not providing an appropriate response. But without a test page to confirm things, it's not going to be possible to craft a solution for you.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok PMW57

    i think my problem summarize is "how to place in certain data appearing in particular form of database by using javascript"

    this my search page -i know it wrote using table i will fix it later -
    Code:
    <&#37;@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
    <!--#include file="Connections/conn.asp" -->
    <%
    var rs_search__MMColParam = "1";
    if (String(Request.Form("search")) != "undefined" && 
        String(Request.Form("search")) != "") { 
      rs_search__MMColParam = String(Request.Form("search"));
    }
    %>
    <%
    var rs_search = Server.CreateObject("ADODB.Recordset");
    rs_search.ActiveConnection = MM_conn_STRING;
    rs_search.Source = "SELECT * FROM dbo.New_ADSLContractExtensionBase WHERE New_telephone1 = '"+ rs_search__MMColParam.replace(/'/g, "''") + "'";
    rs_search.CursorType = 0;
    rs_search.CursorLocation = 2;
    rs_search.LockType = 1;
    rs_search.Open();
    var rs_search_numRows = 0;
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>search result</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <style type="text/css">
    <!--
    .style1 {font-family: "Times New Roman", Times, serif}
    .style2 {font-family: Geneva, Arial, Helvetica, sans-serif}
    .style3 {font-family: Georgia, "Times New Roman", Times, serif}
    -->
    </style>
    </head>
    
    <body>
    <div align="center">
      <% if (!rs_search.EOF || !rs_search.BOF) { %>
      <table width="437" border="0" align="center">
        <tr bgcolor="#CCCCCC">
          <td width="95">&nbsp;</td>
          <td width="278"><%=(rs_search.Fields.Item("New_ContractName").Value)%></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_telephone1").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_StartDate").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_Enddate").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_Speed").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_RouterRent").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_OptionPack").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_FirstName").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_MiddleName").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_LastName").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_StreetName").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_HomePhone").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_telephone2").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td><%=(rs_search.Fields.Item("New_PayBoy").Value)%></td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr bgcolor="#CCCCCC">
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <% } // end !rs_search.EOF || !rs_search.BOF %>
      <% if (rs_search.EOF && rs_search.BOF) { %>
    </div>
    <p align="center" class="style3"><strong>الرقام الذي ادخلته غير موجود </strong></p>
    <div align="center" class="style3"><strong>
      <% } // end rs_search.EOF && rs_search.BOF %>
    </strong></span><span class="style2"><strong>
    </strong></span><span class="style1"><strong>
    </strong></span><strong>
    </strong>
    </div>
    <p>&nbsp; </p>
    </body>
    </html>
    <%
    rs_search.Close();
    %>
    in New_Speed field data store in untrue value"1-2-3"i want this value appear in true value"256-512-1024"
    and for working in this problem i thought solving it by turn this untrue value to true one in my clint-side end by using javascript because i havent any ability to do it in straight way by modify it in databse
    so i think i can use array like this:
    Code:
    var data = 2;
    var speed = ["256", "512", "1024", "2048", "4096"];
    var arrayi = data - 1;
    document.write(speed[arrayi]);
    but i want the data var change by changing in search result but i dont know how to do it

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,678
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    Do not use javascript for that because you can't guarantee that it's going to run. Head over to the asp forum (or whichever ever language is used) and do it from there instead.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    but why u think that this the language server and i will do it in my client side and i


    and i ask whats javascript limits in this case
    , i want to know what's the problems that face javascript

  10. #10
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,678
    Mentioned
    99 Post(s)
    Tagged
    4 Thread(s)
    The <&#37; ... %> is the notation for a server-side language. That is where you should be doing the conversion.

    I do not know the language you are using, though I can guess that it's asp. Either way though, something as important as converting database values to something meaningful lies in the realm of server-side code.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #11
    SitePoint Zealot
    Join Date
    Aug 2007
    Location
    Egypt-Luxor city
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sure paul this classic ASP coded file.
    thx for ur recommandtion i will try search for a solution In the light of ur suggestion


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
  •