I have create form as below - - <table>
-
<tr>
-
<td align="right">VLAN Name : </td>
-
<td>
-
<select name="vlan_name" style="width:150px ">
-
<% set rs = conn.execute("select vlan_name from vlan_master order by vlan_name")
-
do while not rs.eof%>
-
<option value="<%=rs("vlan_name")%>"><%=rs("vlan_name")%></option>
-
<% rs.movenext
-
loop%>
-
</select>
-
</td>
-
</tr>
-
<tr>
-
<td align="right">Item : </td>
-
<td>
-
<select name="item" style="width:150px ">
-
<% set rs = conn.execute("select item, item_desc from network_item order by item_desc")
-
do while not rs.eof
-
if rs("item") = "PC" then%>
-
<option value="<%=rs("item")%>" selected><%=rs("item_desc")%></option>
-
<% else%>
-
<option value="<%=rs("item")%>"><%=rs("item_desc")%></option>
-
<% end if
-
rs.movenext
-
loop%>
-
</select>
-
</td>
-
</tr>
-
<tr>
-
<td align="right">IP Address : </td>
-
<td align="left"><input type="text" name="ip_address" style="width:150px "/></td>
-
</tr>
-
<tr>
-
<td align="right">MIS No : </td>
-
<td>
-
<select name="mis_no" style="width:250px ">
-
<% set rs = conn.execute("select a.mis_no, a.seq_no, a.lot_no, b.item_description from item_procurement_history_dtl a, item_master b where a.status = 'D' and b.item_code = a.item_code order by a.item_code, substr(mis_no, instr(mis_no, '/', -1)+1)")
-
do while not rs.eof%>
-
<option value="<%=rs("mis_no")%>"><%=rs("mis_no")%></option>
-
<% rs.movenext
-
loop%>
-
</select>
-
</td>
-
</tr>
-
<tr>
-
<td align="right">Employee name : </td>
-
<td align="left"><input type="text" name="emp_name" style="width:300px "/></td>
-
</tr>
-
</table>
I am using two table 1) Item_master and 2) IP_Address.
The field of IP_Address is given below
1) Item, IP_Address, EmpName
Here Item and IP_Address field is filled with fixed set of ip addresses and item. And if any ip address is assigned to anybody , then empname is filled, if ip address is released then empname field against that ip address is deleted.
If user select Computer in Item field, then the second field IP Address should be display the first available ip address from table automatically. How can I achieve this?
Thanks and regards,
Vikas
Jun 10 '08
17 2774 acoder 16,027
Recognized Expert Moderator MVP
First of all, decide what format you want to return the output in using ASP. You could return HTML ready for use, or JSON/XML to be parsed. When the response is complete, either set the HTML directly or, if you've returned JSON or XML, parse the response. If you have problems implementing this, post here with your attempt.
I am giving you my complete source code for your kind consideration.
There is three list in this programme.
1) List of all Virtual Local Area Network VLAN (Maximum 255 connection in single network).
2) List of all items in single VLAN (like routers, computers, printers, switches, server, camera).
3) List of all IP in single item. there is total 255 IP in single VLAN and quota is fixed for each item.
Process should be -
If I select VLAN, then list of items available in that VLAN should display, And if I select items then list of IP should display with blank IP address as selected by default. AJAX method is used to display the list of IP with blank IP as selected. Then I write the name of employee or location to which this IP is allotted.
I am giving you the code of 'getip.asp' which is called in line no. 14.
Problem -
Now what happens in programe is that after selecting items in list it displays list of all IP with blank IP as selected, but it lost VLAN name.
What should I do to avoid this?
Thanks and regards,
Vikas
acoder 16,027
Recognized Expert Moderator MVP
The reason why that happens is that you're replacing the div "txtHint"'s contents with the ASP file. The ASP script that you call should only output what is needed, not the whole page. So if you want the IPs only, return the HTML for the IP select named "ip_address " and set/replace that only.
How can I return the HTML for the IP select named "ip_address " and set/replace that only? Please tell me.
Thanks and regards,
Vikas
acoder 16,027
Recognized Expert Moderator MVP
Look at this quick modification that I've made to getip.asp: - <%
-
response.expires=-1
-
sql="select ip_address from vlan_detail where item ="
-
sql=sql & "'" & request.querystring("q") & "'"
-
-
set conn=Server.CreateObject("ADODB.Connection")
-
conn.open "Provider=MSDAORA.1; dsn=ipis; Password=ipis; User ID=ipis; Data Source=isap2000; Persist Security Info=True"
-
set rs = Server.CreateObject("ADODB.Recordset")
-
rs.Open sql, conn
-
set rs=conn.execute("select ip_address from vlan_detail where item ='"&v_item&"' and vlan_name='"&v_lan&"' and seq_no = (select min(seq_no) from vlan_detail where allotted_to is null and item ='"&v_item&"' and vlan_name='"&v_lan&"')")
-
dim v_ip_address
-
v_ip_address = rs("ip_address") %>
-
<select name="ip_address" style="width:150px ">
-
<% set rs=conn.execute("select ip_address from vlan_detail where item ='"&v_item&"' and vlan_name='"&v_lan&"'")
-
do while not rs.eof
-
if rs("ip_address") = v_ip_address then%>
-
<option value="<%=rs("ip_address")%>" selected><%=rs("ip_address")%></option>
-
<% else %>
-
<option value="<%=rs("ip_address")%>"><%=rs("ip_address")%></option>
-
<% end if
-
rs.movenext
-
loop %>
-
</select>
Only the select is output. You can set the innerHTML of a div containing the select.
I didn't understand what you have done. Please explain me clearly and what to do next? What about the remaining lines of code?
Thanks and regards,
Vikas
acoder 16,027
Recognized Expert Moderator MVP
I've just removed all the extra duplicated code, so that only the select element is output. Run that page directly (without using Ajax) and you'll see what I mean (though check for any syntax errors in the ASP).
What you need to do next is put a div or span around the IP select in the main page and set its innerHTML when the Ajax request is complete/successful. Make sure you give it an ID, so you can access it. Alternatively, just return the options only and set the select element's innerHTML instead.
Okay!
Let us see what happens.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: William Wisnieski |
last post by:
Hello Everyone,
I have a main form with a datasheet subform that I use to query by form.
After the user selects two criteria on the main form and clicks the
cmdShowResults button on the main form, the subform returns the records
based on the two criteria. The criteria used on the main form are values
selected in two list boxes. When the user clicks on the first list box
(lstCollege), it returns values in the second list box...
|
by: arthur-e |
last post by:
How can you select records based on more than one combo box -
I have a combobox that selects records based on name
(I'm sure this has been asked a thousand times - web site answer/link
could be helpful too; but I'm so bad with syntax that specifics will
be MOST helpful)
SELECT DISTINCT .,
. FROM
Union Select "<ALL>" , NULL From
;
|
by: Stephen Miller |
last post by:
When I dynamically populate a HtmlSelect combo box, the Value property
consistently fails to return the item selected, defaulting instead to
the first item in the list. For example:
Protected WithEvents Fruits As System.Web.UI.HtmlControls.HtmlSelect
Protected WithEvents Results As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
…
Private Sub Page_Load(ByVal sender As System.Object, ByVal...
|
by: Zlatko Matiæ |
last post by:
Hello.
How to reference selected values from a multi-select list box, as a
criteria in a query ?
Is it possible at all?
Regards,
Zlatko
|
by: Greg Scharlemann |
last post by:
I'm not sure the best way to accomplish this... my hunch is with
javascript, but I'm not sure if using server side code (PHP) would be
easier.
I'm adding people to a database. People have a first name, last name,
and a undetermined number of Cities and States with which they can be
associated. I've got a drop down box that I would like to use to
display the number of inputs to allow for city/state entry. I would
like to dynamically...
| |
by: mso5 |
last post by:
Hi,
I am trying to build a small form with a list of countries and regions by each country (yes, the classical one), and I'm stuck with it. I'm using AJAX also, and I manage to get the correct value from the selection, but it does not modify the second list based on the first selection. Can anyone tell me what am I doing wrong in this code? I am not a programmer..
Thank you!
<script language="javascript" type="text/javascript">
<!--
|
by: ramchml |
last post by:
i have two select boxes.based on the selected value in one select box it show the maximum options in the other select box in next page.i used javascript onclick function.for first time it shows correct options in the second select box if i go back and change the value in the 1st select box it shows me the previous value in the 2nd select box,the value not get changed.it is happening only in opera9 all the other browsers its working fine.it seems...
|
by: hello2008 |
last post by:
Hi,
I have just started coding in PHP. I have coded a web page using HTML, JS, and PHP. An HTML table has to be populated dynamically using the data from the backend.
Presently I have 5 records in the backend table so I get 5 HTML-table rows. I have created a session object starting from the login page. The requirement is that as soon as I log in and my request gets forwarded to the foll PHP page I should be seeing the foll. dynamically...
|
by: godkrishna |
last post by:
Hi Guys.. I am new to javascript.. pls bare with me :)
In my form, i have a table with two columns. first column has checkboxes and second has dropdown lists.
On check of each check box.. certain 'options' are addded/removed from its corresponding dropdown list.
My problem is, after adding/removing the 'options' dynamically, if I select the newly added option and submit the form, the corresponding value for the newly added option is...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |