473,322 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Quote line items

tim
Hello All

I am writing an asp app for generating quotes. What I would like to do
is allow the user to edit the quote lines without having to open a new
page each line.

On the quote I have created a loop which goes through the recordset and
populates a sort of data grid. Can you use javascript or something so
the user can click an edit icon on the appropriate line item in the
grid and edit the line details there instead of having to open another
page to edit the line item.

some pointers would be great

Thanks

Timc

Oct 29 '05 #1
1 1590
ti*@exelsor.co.nz wrote:
Hello All

I am writing an asp app for generating quotes. What I would like to do
is allow the user to edit the quote lines without having to open a new
page each line.

On the quote I have created a loop which goes through the recordset and
populates a sort of data grid. Can you use javascript or something so
the user can click an edit icon on the appropriate line item in the
grid and edit the line details there instead of having to open another
page to edit the line item.

some pointers would be great


Depending on what users have to enter, you can:

- use a prompt to get a value that is written to the cell
- use a div with a textarea element to get the new text
- use a popup with a text area or similar to get the new text

Here's something to get you started. For the modDiv() you could
position the div more appropriately by using the location of the element
that was clicked on (there are plenty of posts showing how to do it),
I've just plonked it on the page. You could also do a lot more with
styling etc.

<html><head>
<title>play</title>
<script type="text/javascript">

// Use a prompt to get new text
function modPrompt(el)
{
var txt = getElText(el);
var newText = prompt('Current value: ' + txt);
if ( newText || '' == newText)
while(el.firstChild) {
el.removeChild(el.firstChild);
}
el.appendChild(document.createTextNode(newText));
}

// Use a div to get new text
function modDiv(el)
{
var txt = getElText(el);

// Create a div to use as a dialog
var mDiv = document.createElement('div');
mDiv.style.backgroundColor = '#dddddd';
mDiv.style.border = '1px solid #999999';
mDiv.style.position = 'absolute';
mDiv.style.top = '50px';
mDiv.style.left = '50px';
mDiv.appendChild(document.createTextNode(
'Edit the text, then click save or cancel'));
mDiv.appendChild(document.createElement('br'));

// Use a text area to edit content
var mTA = document.createElement('textarea');
mTA.value = txt;
mDiv.appendChild(mTA);

// Add close button
mDiv.appendChild(document.createElement('br'));
var oBut = document.createElement('input');
oBut.type = 'button';
oBut.value = 'Close';
oBut.onclick = function () {
mDiv.parentNode.removeChild(mDiv);
}
mDiv.appendChild(oBut);

// Add Save button
var oBut = document.createElement('input');
oBut.type = 'button';
oBut.value = 'Save';
oBut.onclick = function () {
while(el.firstChild) {
el.removeChild(el.firstChild);
}
var newText = mTA.value;
el.appendChild(document.createTextNode(newText));
mDiv.parentNode.removeChild(mDiv);
}
mDiv.appendChild(oBut);
document.body.appendChild(mDiv);
}

// Get the text content of an element
function getElText(el)
{
// DOM 3 browsers
if (el.textContent) return el.textContent;

// IE 6 or less (will 7 support textContent?)
if (el.innerText) return el.innerText;

// Others
var x = el.childNodes;
var txt = '';
for (var i=0, len=x.length; i<len; ++i){
if (3 == x[i].nodeType) {
txt += x[i].data;
} else if (1 == x[i].nodeType){
txt += getElText(x[i]);
}
}
return txt.replace(/\s+/g,' ');
}

</script>
<body>

<table border="1">
<tr>
<td>Click the right cell to edit - uses a prompt</td>
<td onclick="modPrompt(this);"> this
<b>Something</b>
needs to be changed
</td>
</tr>
<tr>
<td>Click the right cell to edit - uses a
div and text area</td>
<td onclick="modDiv(this);"> this
<b>needs changing</b>
too
</td>
</tr>
</table>

</body>
</html>

--
Rob
Oct 29 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Frostillicus | last post by:
I'm having difficulty creating a menu on the left of a web page where each link appears to have a 4px padding around the edge but I'm trying to do this as a pure unordered list. The "current web...
2
by: Hugh Macdonald | last post by:
I'm writing a tool at the moment that reads in an external file (which can use any Python syntax) At the moment, I'm reading the file in using: scriptLines = open(baseRippleScript).read()...
1
by: steeve_dun | last post by:
Hi, I have this kind of code: Items= Items= .... I need to transform it or treat it to have just: Items= Items= without the line breaks.
4
by: Peeter Ups | last post by:
I have several tables in my database. I use these to create 'quotations' that show product code, description, selling price and quantity required. Users can enter as many lines as possible and a...
0
by: Navin | last post by:
Hi, I am making a code editor in C# and want to display line numbers to the left. I have a UserControl with a ListView docked to the left edge and a TextBox that makes up the rest. I am able to...
3
by: dav | last post by:
HI, I am new to vb.net and i want to open a batch file to read the last numeric number of each line and use that number (1/0) to determine if a particular item of drop down box should be...
3
by: Richard | last post by:
In ASP.NET 1.1, I have SmartNavigation turned on so that the user's focus will remain on the line in the datagrid they choose to edit. When the user chooses to add a new line in the datagrid,...
0
by: mollyf | last post by:
I've got a combo box that I want to bind a collection to. I got the error "Complex Data Binding accepts as a data source either an IList or an IListSource" so I tried using the BindingSource,...
3
trkrbabe
by: trkrbabe | last post by:
Hi, this is my first time posting here. It appears that I am taking the same class as a few other people here. I have only been learning Java for about five weeks now. I have my Product class...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.