I have been been working on this for a while and unable to resolve the issue at hand. I have decided to go to the community to try and get this resolved somehow.
My issue is this:
I have a a query that displays a result set in a table. In one of the columns there is a link with a javascript event that pops up a lightbox form eg:
<a href="javascript:void(0);" onClick="openbox('#Title#', 1)">Bid Project</a>
The problem is 2 fold.
-
I need to be able to pass a dynamic value in the link above to the lightbox form ie: an ID of a result set.
-
I would be able to do this by appending it to the link like so:
<a href="http://mysite.com/index.cfm?&jobid=#jobID#" onClick="openbox('#Title#', 1)">Bid Project</a>
But by doing this redirects the page rendering the lightbox in effective.
the JS used to open the box is as below:
function gradient(id, level)
{
var box = document.getElementById(id);
box.style.opacity = level;
box.style.MozOpacity = level;
box.style.KhtmlOpacity = level;
box.style.filter = "alpha(opacity=" + level * 100 + ")";
box.style.display="block";
return;
}
function fadein(id)
{
var level = 0;
while(level <= 1)
{
setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10);
level += 0.01;
}
}
// Open the lightbox
function openbox(formtitle, fadin)
{
var box = document.getElementById('box');
document.getElementById('filter').style.display='block';
var btitle = document.getElementById('boxtitle');
btitle.innerHTML = formtitle;
if(fadin)
{
gradient("box", 0);
fadein("box");
}
else
{
box.style.display='block';
}
}
// Close the lightbox
function closebox()
{
document.getElementById('box').style.display='none';
document.getElementById('filter').style.display='none';
}
And the html form utilized is as below this:
<cfform id="form" name="form" method="post" action="">
<h1>Bid Project</h1>
<br>
<label>Project ID:</label>
<cfinput type="text" name="jobid" value="#gprojects.jobID#" disabled="true" />
<label>Bid Amount:
<span class="small">Enter a valid bid amt.</span>
</label>
<cfinput type="text" name="Price" id="Price" value="" maxlength="15" required="true" validate="noblanks" message="please enter your bid!"/>
<label>Comments:
<span class="small">Min. size 1000 chars</span>
</label>
<cftextarea name="Description" id="textarea" value="" width="100" cols="60" maxlength="1000" ></cftextarea>
<cfinput type="submit" name="submit" class="subbttn" value="Submit Bid" />
<cfinput type="button" name="submit" class="subbttn" value="Cancel Bid" onclick="closebox();"/>
<cfinput type="hidden" name="action" id="action" value="submitted" />
<cfinput type="hidden" name="userid" id="userid" value="#Session.userid#" />
<cfinput type="hidden" name="jobid" value="#url.jobID#" />
<!--- <button type="submit">Bid Project</button> --->
<div class="spacer"></div>
</cfform>
If someone can figure out what i am doing wrong I am extending my appreciation before hand.
Thanks