Solved

xml use in mailto and target element of <a href> tag .....

Posted on 2004-03-24
11
567 Views
Last Modified: 2013-11-19
Hi,

I have a very unique rpoblem.

I am using the datasrc - datafld element of xml in a a table for getting cotent for my page.

Now, in every td of the table, i have a mailto: link which - when clicked the the web url should be inserted in the email body part. Baiscally, i want to insert the xml node value in the mailto: subjecct part, like the way we attach to the table by :

<a class="mySpacelinks" href=<span datafld="urlitem"></span><span datafld="urllabel"></span></a>

I tried adding span to the mailto body, but it gives me <span datafld="urlitem"></span> in the body and the not the actual url.

Pls help.

Also, in the html page with href links, i want to add "target" element in it with the value for it coming from an xml file, similar like adding target=<span datafld="target"></span>. i tried it in anchor elemtn but it gives me error and not correct output.

Pls help.
0
Comment
Question by:sumitshah4u
  • 4
  • 3
  • 2
11 Comments
 
LVL 15

Expert Comment

by:dualsoul
Comment Utility
sounds not very clear to me.

may be you post what do you have and the result you want to achieve?
0
 
LVL 26

Expert Comment

by:rdcpro
Comment Utility
Single valued consumers automatically bind to the correct attribute.  For example, if you have:

[...]
<xmlNode>
    <urlitem>mailto:rdcpro@hotmail.com</urlitem>
    <urllabel>Mike Sharp</urllabel>
</xmlNode>
[...]

then this should work:

<a class="mySpacelinks" datafld="urlitem"><span datafld="urllabel"></span></a>

assuming this is in a table that provides the datasrc attribute.  Otherwise, you'll need to add the datasrc to the anchor.

Regards,
Mike Sharp
0
 

Author Comment

by:sumitshah4u
Comment Utility
mike, i want this line in the urlitem :

mailto:?subject=Please visit this link&body=https://www.mphasis.com

I added this in xml but there is no output and sort of error- no xml contents are loaded in the asp file.

Any ideas
0
 

Author Comment

by:sumitshah4u
Comment Utility
any body there??
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 15

Expert Comment

by:dualsoul
Comment Utility
hm...may be you post your xml/xslt/asp code? just we can see ?
0
 

Author Comment

by:sumitshah4u
Comment Utility
the table is :

<table cellpadding="1" cellspacing="1" border="0" dataSrc="#Articles" width="95%">
                                                                                    <tr>
                                                                                    <td height="16" colspan="2"><img src="B2E/images/spacer.gif" width="1" height="12" border="0" alt=""></td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                    <td colspan="2"><a target="_blank" class="shortlinks" href=<span datafld="urlitem"></span><span datafld="urllabel"></span></a></td>
                                                                                    </tr>
                                                                                    <tr>
                                                                                    <td colspan="2" class="popuptext"><span datafld="description"></span></td>
                                                                                    </tr>      
                                                                                    <tr>
                                                                                    <td colspan="2" class="sourceText"><span datafld="author"></span></b></td>
                                                                                    </tr>      
                                                                                    <tr>
                                                                                    <td colspan="2" class="sourceText"><span datafld="source"></span></td>
                                                                                    </tr>
                                                                        <tr>
                                                                                    <td class="popuptext" width="40"><img src="B2E/images/Envelope.gif"></td>
                                                                                    <td width="93%">
<a class="textlinks1" href=<span datafld="mailinfo"></span>Post this to your colleague</a>
                                                                                    </td>
                                                                                    </tr>                                          </table>

now everyhting works fine and all data frm my Articles.xml file is shown BUT when in the mailinfo xml tag, i put - mailto:?subject=Please visit this link&body=https://www.mphasis.com, it gives me error.

The purpose is that i get the mailto: in the a href tag WITH THE SPECIFIC PAGE URL THAT I want to be added in the email.  

You can suggest me other ways. I tried to access the <span datafld="mailinfo"> in the javascript variable but got errors. I had plan then to use this js variable in the document.write(<a href="mailto:?subject=demo&body" + valueofspanfrmjavascript.


                                                                              
0
 
LVL 26

Expert Comment

by:rdcpro
Comment Utility
No, you're not doing as I suggested.  Don't try to put a span tag in an attribute--that doesn't work; it's not well-formed HTML.  Just bind the anchor tag to the datafield.  The DSO will provide an href attribute, and put the contents of the field in there automatically.

<a class="mySpacelinks" datafld="mailinfo"><span datafld="urllabel"></span></a>

The anchor tag works *exactly* like a span tag--you bind the tag, not the attribute.  The DSO knows that an anchor tag that's bound gets its href attribute bound.  So make sure your anchor tag is like mine, NO href attribute, and just a single datafld attribute.

Regards,
Mike Sharp

0
 

Author Comment

by:sumitshah4u
Comment Utility
mike,

i want to put this part :

mailto:?subject=Please visit this link&body=https://www.mphasis.com

in the 'mailinfo' xml tag in my xml file, so that when the page is loaded - the anchor elements href part has the respective "mailto.....with body email subject" i want.

Is it possible?i tried but gives me an error output.

Can u try 4 me. Gr8 if u can do it

0
 
LVL 26

Accepted Solution

by:
rdcpro earned 205 total points
Comment Utility
Well, you have to use &amp; whereever you need an "&" because that's one of the five markup characters.  Here's a working example that also pages through the records.

Regards,
Mike Sharp


This HTML:

<html>
<head>
<title>http://dev.rdcpro.com - Databound Table</title>
</head>
<body>
<XML ID="xmlData" SRC="test.xml"></XML>
<center>
<p>
    Change the number of records viewed:&nbsp;&nbsp;
    <input type="text" size="5" value="1" onblur="Orders.dataPageSize = this.value;">
</p>
<p>
Page through the records:&nbsp;&nbsp;
<button id="cmdFirst" onclick="Orders.firstPage()">&lt;&lt;</button>
<button id="cmdPrevious" onclick="Orders.previousPage()">&lt;</button>
<button id="cmdNex"t onclick="Orders.nextPage()">&gt;</button>
<button id="cmdLast" onclick="Orders.lastPage()">&gt;&gt;</button>
</p>
</center>
<table ID="Orders" datasrc=#xmlData datapagesize="1" WIDTH="90%" style="table-layout:fixed">
    <col Width="10%">
    <col Width="22%">
    <col Width="22%">
    <col Width="22%">
    <col Width="10%">
    <col Width="*">
    <thead>
    <tr>
        <td Colspan=6><hr width="100%" color="#808080"></td>
    </tr>
    <tr valign="top">
    <td><font size="1"><strong>OrderID</strong></font></td>
    <td><font size="1"><strong>OrderDate</strong></font><br>
        <font size="1"><strong>Mailto Link</strong></font></td>
    <td><font size="1"><strong>RequiredDate</strong></font><br>
        <font size="1"><strong>ShipAddress</strong></font></td>
    <td><font size="1"><strong>ShippedDate</strong></font><br>
        <font size="1"><strong>ShipCity</strong></font></td>
    <td><font size="1"><strong>OrderID</strong></font><br>
        <font size="1"><strong>ShipRegion</strong></font></td>
    <td><font size="1"><strong>Freight</strong></font><br>
        <font size="1"><strong>ShipPostalCode</strong></font></td>
    </tr>
    <tr>
    <td colspan=6><hr width="100%" color="#808080"></td>
    </tr>
    </thead>
    <tr valign="top" style="border-bottom:1px;">
        <td><SPAN style="font-size:x-small;" DATAFLD=OrderID></SPAN></td>
        <td><SPAN style="font-size:x-small;" DATAFLD=OrderDate></SPAN><br>
            <a DATAFLD=mailinfo><SPAN style="font-size:x-small;" DATAFLD=ShipName></SPAN></a>
            </td>
        <td><SPAN style="font-size:x-small;" DATAFLD=RequiredDate></SPAN><br>
            <SPAN style="font-size:x-small;" DATAFLD=ShipAddress></SPAN></td>
        <td><SPAN style="font-size:x-small;" DATAFLD=ShippedDate></SPAN><br>
            <SPAN style="font-size:x-small;" DATAFLD=ShipCity></SPAN></td>
        <td><SPAN style="font-size:x-small;" DATAFLD=OrderID></SPAN><br>
            <SPAN style="font-size:x-small;" DATAFLD=ShipRegion></SPAN></td>
        <td><SPAN style="font-size:x-small;" DATAFLD=Freight></SPAN><br>
            <SPAN style="font-size:x-small;" DATAFLD=ShipPostalCode></SPAN></td>
    </tr>
</table>
</body>
</html>


And this XML:

<?xml version="1.0" encoding="ISO-8859-1"?>
<SalesData>
    <Order>
        <OrderID>10248</OrderID>
        <CustomerID>VINET</CustomerID>
        <EmployeeID>5</EmployeeID>
        <OrderDate>7/4/1996</OrderDate>
        <RequiredDate>8/1/1996</RequiredDate>
        <ShippedDate>7/16/1996</ShippedDate>
        <ShipVia>3</ShipVia>
        <Freight>32.38</Freight>
        <ShipName>Vins et alcools Chevalier</ShipName>
        <ShipAddress>59 rue de l'Abbaye</ShipAddress>
        <ShipCity>Reims</ShipCity>
        <ShipRegion/>
        <ShipPostalCode>51100</ShipPostalCode>
        <ShipCountry>France</ShipCountry>
        <mailinfo>mailto:?subject=Please visit this link&amp;body=https://www.mphasis.com</mailinfo>
        <linktext>Click here to visit mphasis.com</linktext>
    </Order>
    <Order>
        <OrderID>10249</OrderID>
        <CustomerID>TOMSP</CustomerID>
        <EmployeeID>6</EmployeeID>
        <OrderDate>7/5/1996</OrderDate>
        <RequiredDate>8/16/1996</RequiredDate>
        <ShippedDate>7/10/1996</ShippedDate>
        <ShipVia>1</ShipVia>
        <Freight>11.61</Freight>
        <ShipName>Toms Spezialitäten</ShipName>
        <ShipAddress>Luisenstr. 48</ShipAddress>
        <ShipCity>Münster</ShipCity>
        <ShipRegion/>
        <ShipPostalCode>44087</ShipPostalCode>
        <ShipCountry>Germany</ShipCountry>
        <mailinfo>mailto:?subject=Please visit this link&amp;body=http://www.rdcpro.com</mailinfo>
        <linktext>Click here to visit mphasis.com</linktext>
    </Order>
    <Order>
        <OrderID>10250</OrderID>
        <CustomerID>HANAR</CustomerID>
        <EmployeeID>4</EmployeeID>
        <OrderDate>7/8/1996</OrderDate>
        <RequiredDate>8/5/1996</RequiredDate>
        <ShippedDate>7/12/1996</ShippedDate>
        <ShipVia>2</ShipVia>
        <Freight>65.83</Freight>
        <ShipName>Hanari Carnes</ShipName>
        <ShipAddress>Rua do Paço, 67</ShipAddress>
        <ShipCity>Rio de Janeiro</ShipCity>
        <ShipRegion>RJ</ShipRegion>
        <ShipPostalCode>05454-876</ShipPostalCode>
        <ShipCountry>Brazil</ShipCountry>
        <mailinfo>mailto:?subject=Please visit this link&amp;body=https://www.google.com</mailinfo>
        <linktext>Click here to visit google.com</linktext>
    </Order>
</SalesData>
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now