Getting a text link to call a javascript function

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
bowlesj
 
 
Posts: 50
Joined: Tue Aug 12, 2014 6:59 pm

Getting a text link to call a javascript function

Post by bowlesj » Fri Dec 22, 2017 2:51 pm

I am not sure if I have ever done this before but regardless I am having trouble getting this one to work. I want to click some text on a webpage such that it will call a javascript function to provide a popup. I have this type of popup working on the text in the headings of a table by the way.


Here is the link to the actual page. The text with the link is "Stage Restrictions".
http://yourcommonsongjams.com/frmJamSchedule_TS34.html

The source code for the webpage that is showing looks like this.

Code: Select all

<span style="color:#000000;font-family:Arial;font-size:19px;"><a href="#" onclick="funcHelp(\"Stage Restrictions\",\"$StageRestrictionHelp\");return false;">Stage Restrictions</a>:</span></div>
Is seems I can not attach png pictures so I will describe how I set up the text link items.

Link:
I chose "external Web Address"
The URL box contains "#" (it seems to get forced to that).
title is blank.
Open in the same browser window (of course this is a popup).
Parameters is blank

HTML:
I left this blank.

Edit Event:
onclick is chosen
Action is Javascript function
Target is left blank
This is in the function field. funcHelp(\"Stage Restrictions\",\"$StageRestrictionHelp\")

The code for loading the $StageRestrictionHelp variable is below.

Code: Select all

$StageRestrictionHelp = "There are five stage slots working from the back of the room to the front. Stage slots are filled on a first come first serve basis for each song. However some instruments can not be switched from song to song such as drums, piano, congas, upright base. So what I have done to describe how you can potentially fit in to a song is code the strage restriction area to show the initial instruments assigned to eash slot. For example: Slot#1-Guitar, Slot#2-Bass, Slot#3-Piano Slot#4-SamePiano. Slot#5-Horn. However if a slot is initially assigned to guitar for example this seat and music stand can be used by other types of insturments on different songs. So I code the description for this slot like this Slot#1-Guitar-BHV where the BHV means Bass or Horns or Vocals could use that slot if there is no guitar assigned to it yet for the specific song you are interested in. If all slots get filled without a guitar I assigne BIAB to do the guitar part. If you see Slot#1-Drums it will not have letters after it since only drums can make use of this slot. It would be the same with Slot#2-UprightBass. Slot#3-Piano-BGV means that a bass guitarist or guitarist or horn player or vocalist could sit at the piano and use the piano's mustic stand to play. If a vocalist needed to use that slot I would run a mike over the piano. If you are not sure just request to play on the song and I will email you if there is a problem.";

When I press F12 on the browser to debug the javascript funcHelp function is not being called.

Any help would be appreciated.
Thanks,
John

User avatar
Pablo
 
Posts: 13926
Joined: Tue Mar 28, 2006 12:00 pm
Location: Europe
Contact:

Re: Getting a text link to call a javascript function

Post by Pablo » Fri Dec 22, 2017 3:02 pm

I think:

Code: Select all

funcHelp(\"Stage Restrictions\",\"$StageRestrictionHelp\")
should be

Code: Select all

funcHelp('Stage Restrictions','$StageRestrictionHelp')
Also, I assume '$StageRestrictionHelp' is a PHP variable?
Otherwise it should be

Code: Select all

var StageRestrictionHelp = """;

Code: Select all

funcHelp('Stage Restrictions', StageRestrictionHelp)
Please note that I cannot provide support on programming. When using advanced functionality like this it is assumed that you know what you are doing.

bowlesj
 
 
Posts: 50
Joined: Tue Aug 12, 2014 6:59 pm

Re: Getting a text link to call a javascript function

Post by bowlesj » Fri Dec 22, 2017 4:59 pm

Thanks Pablo. Your were helpful by just saying " I assume '$StageRestrictionHelp' is a PHP variable". It jogged my memory as to what I have to do. I had to do the following to get it to work.

This code had to go into the javascript box for the text link.
<?php echo ('funcHelp(\'Stage Restrictions\',\'' . $StageRestrictionHelp. '\')'); ?>
This is the new resulting HTML source code that worked.
<a href="./frmTestimonials.php" onclick="funcHelp('Stage Restrictions','There are five stage slots working from the back of the room to the front. Stage slots are filled on a first come first serve basis for each song. However some instruments can not be switched from song to song such as drums, piano, congas, upright base. So what I have done to describe how you can potentially fit in to a song is code the strage restriction area to show the initial instruments assigned to eash slot. For example: Slot#1-Guitar, Slot#2-Bass, Slot#3-Piano Slot#4-SamePiano. Slot#5-Horn. However if a slot is initially assigned to guitar for example this seat and music stand can be used by other types of instruments on different songs. So I code the description for this slot like this Slot#1-Guitar-BHV where the BHV means Bass or Horns or Vocals could use that slot if there is no guitar assigned to it yet for the specific song you are interested in. If all slots get filled without a guitar I assign BIAB to do the guitar part. If you see Slot#1-Drums it will not have letters after it since only drums can make use of this slot. It would be the same with Slot#2-UprightBass. Slot#3-Piano-BGV means that a bass guitarist or guitarist or horn player or vocalist could sit at the piano and use the piano music stand to play. If a vocalist needed to use that slot I would run a mike over the piano. If you are not sure just request to play on the song and I will email you if there is a problem.');return false;">Stage Restrictions</a>
This is the much simpler sub heading at the top of a table that was working which I compared against to get it to work.
<a href='frmSongOriginOfChords.php?RecKey=1' onclick='funcHelp("Start","The estimated start time. Used to know when we have the minimum 2 hours of songs required before a jam can be scheduled.");return false;'>Start</a>
I don't really understand why the onClick event is called rather than displaying the webpage. Maybe it has to do with the "Return False" code.

I just noticed I need to fix up the spelling :-)

Thanks again,
John

Post Reply

Who is online

Users browsing this forum: No registered users and 21 guests