Support Forum Softcomplex logo
About Us  | Services  | Download  | Order  | Support  | |
| Search | Today's Posts | Stats | Board Rules | Not logged in [ Login | Register ]
go to bottom
Last active: Never

Printable Version | Subscribe | Add to Favourites   Post new thread
Author: Subject: reducing data from server
roger99
Member

Posts: 10
Registered: 9/16/2003
Member Is Offline
posted on 10/8/2006 at 04:23 PM Reply With Quote
reducing data from server


I use asp to dynamically generate input to my tables and it works very well - thx a lot SoftComplexers.
In one table each cell contains almost identical data, i.e.

<a href="JavaScript:openWindow5('http://www.avgifter.com/forum/topic_pop.asp?TOPIC_ID=105')"><img src="images/icon_search.gif" width="16" height="17" border="0" title="LA?s andras A?sikter om sA?ljaren och skriv dina egna!" align="absmiddle"/>

The only unique info is one single number - 105 in this example. Is there a way to do this in a smarter way by just letting the server send the unique number - 105 - and then add the rest of the string in the client?
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 10/9/2006 at 10:50 AM Reply With Quote

use client side wrapper function, something like

function wrap (n_ID) {
return '<a href="JavaScript:openWindow5(\'http://www.avgifter.com/forum/topic_pop.asp?TOPIC_ID=' + n_ID + '\')"><img src="images/icon_search.gif" width="16" height="17" border="0" title="LA?s andras A?sikter om sA?ljaren och skriv dina egna!" align="absmiddle"/>'
}

then instead of that string you use a javascript call:

wrap(105)
View User's Profile View All Posts By User U2U Member
roger99
Member

Posts: 10
Registered: 9/16/2003
Member Is Offline
posted on 10/10/2006 at 03:15 AM Reply With Quote

Thank you, if I only knew how to implement it in my file it should be just what I am looking for. I suppose I start by doing this:

<script type="text/javascript">
function wrap (n_ID) {
return '<a href="JavaScript:openWindow5('http://www.avgifter.com/forum/topic_pop.asp?TOPIC_ID=' + n_ID + '')"><img src="images/icon_search.gif" width="16" height="17" border="0" title="LA?s andras A?sikter om sA?ljaren och skriv dina egna!" align="absmiddle"/>'
}
</script>

After that, how do I make the javascript call (I am embarrased to ask but even more eager to get it into work ;))
I tryed this one but it doesnA?t work

<script type="text/javascript">
document.write(wrap(106))
</script>
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 10/10/2006 at 09:12 AM Reply With Quote

If you just want that HTML written in the document then it's correct (except for the unescaped apostrophes in the HTML inside the function).
View User's Profile View All Posts By User U2U Member
roger99
Member

Posts: 10
Registered: 9/16/2003
Member Is Offline
posted on 10/10/2006 at 10:21 AM Reply With Quote

How do I deal with the "unescaped apostrophes"? - as a matter of fact I am not quit sure what apostrophes you are reffering to. ItA?s a problem for me to express myself in - and understand - two different foreign languages - english an coding ;).

My example was just for testing. What I really want to do is to put result of that call in the left column in my tigra-app - press the yellow button labled "C. Fastprisavtal" in the left column on www.avgifter.com
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 10/10/2006 at 10:43 AM Reply With Quote

Look at my example of the wrap function to see how the apostrophes inside the text are handled. Those has to be escaped with the slashes because the string itself is in apostrophes. Example: The string fragment:

'<a href="JavaScript:openWindow5('http://www.avgifter.com/forum/topic_pop.asp?TOPIC_ID='

will actually be shortened by the apostrophe in the middle causing syntax error:

'<a href="JavaScript:openWindow5('

that's why you escape it with slash like this:

'<a href="JavaScript:openWindow5(\'http://www.avgifter.com/forum/topic_pop.asp?TOPIC_ID='
View User's Profile View All Posts By User U2U Member
roger99
Member

Posts: 10
Registered: 9/16/2003
Member Is Offline
posted on 10/10/2006 at 01:36 PM Reply With Quote

Great, my test-page is working as it should - 1 000 thx.

My next challenge is to populate my cells in the TigraPro-table with wrap(x). I will try to that by just replace the the original string with the string : document.write(wrap(x)) - where x is different for each line. Is it really that easy?
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 10/10/2006 at 02:33 PM Reply With Quote

even easier. you don't need document.write(..). just replace the string with the call to wrap(..) function.
View User's Profile View All Posts By User U2U Member
roger99
Member

Posts: 10
Registered: 9/16/2003
Member Is Offline
posted on 10/10/2006 at 03:41 PM Reply With Quote

:)
View User's Profile View All Posts By User U2U Member
roger99
Member

Posts: 10
Registered: 9/16/2003
Member Is Offline
posted on 10/13/2006 at 04:33 AM Reply With Quote

(:, if I populate the cell with the string wrap(106), the tigra-table do not understand that it is a call - it just prints wrap(106) . I suppose I have to do something to make it understand it's a call and not only a string. How do i make the table to understand that it is a call and not just a string?
View User's Profile View All Posts By User U2U Member
tigra
Administrator

Posts: 2049
Registered: 6/17/2002
Location: US, CO
Member Is Offline
posted on 10/13/2006 at 09:06 AM Reply With Quote

You probably put it inside the apostrophes or quotes. If you want it to be interpreted as a function call and not a string then it should be without quotes or apostrophes.
View User's Profile View All Posts By User U2U Member
roger99
Member

Posts: 10
Registered: 9/16/2003
Member Is Offline
posted on 10/13/2006 at 05:16 PM Reply With Quote

Yes, you were right - I did put it inside quotes. Now its working. Thanks a lot!
View User's Profile View All Posts By User U2U Member
Post new thread

Related Links:
Product Page
Product Demonstrations Live Demos
Simple
XP-styled
3D designed
Product Documentation Documentation
Documenation Page
Change Log
Support Forum Technical Support
Support Forum
Customer Care System
Order Now ORDER NOW!
Add to Cart
View Cart

Go To Top


Powered by XMB 1.9.1 Nexus
Developed By Aventure Media & The XMB Group © 2002-2004