Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

how do i use href with a value from a database

Featured Replies

After making a selection on my index.xsl page, in my case an "Institution", I bring up the people found for that institution and display name, phone, email etc from my database.

At the top of my page I am wanting to display "Our friends from (and whatever institution was selected being in a href). I am wanting the institutionurl, which is a field in my database, in the actual value in my href. For example, say North Carolina was selected on my index.xsl page, I want the top of my page to show:

Our friends at North Carolina. And if selected it goes to www.unc.edu or whatever the link happens to be in the institutionurl field in my database.

Here is what I tried, which is the cdml conversion, but nothing shows up after "Our friends at ":


<h1 class="bluebold">Our friends at <a href="{$default-record/fmrs:field[@name = 'InstitutionURL']/fmrs:data[1]}" target="_blank"><xsl:attribute name="alt">Link to the <xsl:value-of select="$default-record/fmrs:field[@name = 'Institution']/fmrs:data[1]"/>. Please note that selecting this link will open a new browser window.</xsl:attribute><xsl:value-of select="$default-record/fmrs:field[@name = 'Institution']/fmrs:data[1]"/></a></h1>

Then I display each individuals info below that. I can display the info below fine in my "xsl:for-each select" section but I can't seem to figure out the needed code for showing the institutionurl field in the href beforehand.

============

Also, when I show each persons email address, which is inside of my xsl:for-each, I am wanting a person to be able to select it and it open up the email client and place this email address in the "To:" line. When I display my data on my web site I use:

Email: <xsl:value-of select="$record/fmrs:field[@name = 'email']/fmrs:data[1]"/>

Thanks for any assistance,

Doug

  • Author

Here is the file I am working on. Which is called from index.xsl after an institution is selected.

Thanks,

Doug

peoplefound.xsl.zip

  • Author

For the email href I also tried:

 

<xsl:variable name="thisrec" select="fmrs:resultset/fmrs:record[1]"></xsl:variable>

xEmail: <a href="fmxslt:send_email($thisrec/fmrs:field[@name = 'email']/fmrs:data[1])"></a>

 

But still no results.

Any help would be appreciated,

Doug

  • Author

This will show the institution selected in index.xsl as a hyperlink. But it does not show the value of institutionurl, which holds the value of a link brought in from my database, when I get ready to select it.

 

            <xsl:for-each select="/fmrs:fmresultset/fmrs:resultset/fmrs:record">

              <table width="98%" border="0" cellspacing="4" cellpadding="0" align="center" bgcolor="#FFFFCC">

                <xsl:variable name="record" select="current()"/>

                <xsl:variable name="recordnumber" select="position()"/>

.

.

.

<h1 class="bluebold">ECHO Partners at <a href="$record/fmrs:field[@name='institution']/fmrs:data[1]" target="_blank">

<xsl:attribute name="alt">Link to the <xsl:value-of select="$record/fmrs:field[@name='institutionurl']/fmrs:data[1]"/>. Please note that selecting this link will open a new browser window.</xsl:attribute>

<xsl:value-of select="$record/fmrs:field[@name='institution']/fmrs:data[1]"/></a></h1>

 
 



 Instead when I place my mouse on the link it shows:

 
 

http://xxx.xxx.xxx.xx/fmi/xsl/$record/fmrs:field[@name="institutionurl"]/fmrs:data[1]" in a new window

 

The other problem is if I take my href out of my <xsl:for-each etc., I get nothing. And I am wanting it above the <xsl:for-each part of my code.

Thanks,

Doug

this is the code that i have been using:


<a>

     <xsl:attribute name="href"><xsl:value-of select="fmrs:field[@name='institution']/fmrs:data"/></xsl:attribute>link verbage here

</a>

note: if you are inside a for-each loop you do not need the "$record/" record in any of your value-of statements. that part of the code is already there in the for-each statement. you don't need the "record" variable which calls current() because the for-each loop is already putting you in the current record.

My first impression is that the your original code is fine. However, did you place the fields on your layout?

  • Author

Thanks kuma and martin,

It seems I am getting nowhere with this. I do have the fields on my layout. I can't get the link to show before my for-each and I can't get my email link inside of the for-each to work either. Would either of you have an example to share.

Thanks for the note kuma.

I now have what was selected on my index.xsl page showing in an href above my for-each but when I go to select it I get the following instead of the value institutionurl, which is a variable in my database:

 

http://xxx.xxx.xxx.xx/fmi/xsl/$record/fmrs:field[@name="institutionurl"]/fmrs:data[1]" in a new window

 



Here is the code I am using to show the institutionurl:

 
 

<xsl:variable name="ins" select="/fmrs:fmresultset/fmrs:resultset/fmrs:record[1]"/>



<h1 class="bluebold">ECHO Partners at <a href="$ins/fmrs:field[@name='institutionurl']/fmrs:data[1]" target="_blank">

<xsl:attribute name="alt">Link to the <xsl:value-of select="$ins/fmrs:field[@name='institutionurl']/fmrs:data[1]"/>. Please note that selecting this link will open a new browser window.</xsl:attribute>

<xsl:value-of select="$ins/fmrs:field[@name='institution']/fmrs:data[1]"/></a></h1>

 

Doug

Ok I look at it again. Maybe I missed something.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.