Trying to open form inside of shadowbox based off of information in table row

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Trying to open form inside of shadowbox based off of information in table row

So, I'm trying to open a form inside of shadowbox using an on click from a table row.

I'm wanting to pass information from that row into the shadowbox - figured i'd do this via query string.

it's doing something kind of weird right now. When i initialize the web page i'm seeing the 'Loading...' text at the bottom of the page and when i click on a row to generate the shadow box with the form inside it's not even opening the shadow box.

Here is the code i'm using to open the shadow box -

$(document).ready(function () {

    //initialise shadowbox without running setup...
    Shadowbox.init({ skipSetup: true });

    //intercept the form's submission event...
    var fm = $('.resultsrow').on('click', function (e) {

        //on submit...
        var fld = [];

        //get the form's input names and values...
        //$('input', fm).not('[type=submit]').each(function () { fld.push( + '=' + $(this).val().replace(/^#/, '')); });

        //get row data from cells
        var first = $(this).find('firstname').data('first');
        var last = $(this).find('lastname').data('last');
        var jt = $(this).find('jobtitle').data('jt');
        var hrid = $(this).find('hrid').data('hrid');
        var intid = $(this).find('intranetid').data('intid');
        var status = $(this).find('status').data('status');

        //construct url (note : should really be encoded!)...
        var url = 'UpdateForm.aspx?' + 'first=' + first + '&last='+ last +'&jt='+ jt +'&hrid=' + hrid + '&intid=' + intid + '&status=' + status + fld.join('&');

        //open shadowbox...{ player: 'iframe', content: url, width: 700, height: 800 });

        //reset form (if desired)...

        //prevent form submission...
        return false;

APSX code -

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html>
<html xmlns="">
    <head runat="server">
            Job Title Sync
        <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
        <link href="StyleSheet.css" type="text/css" rel="stylesheet" />


    <body class="container">
        <br />
        <div class="pageContent">

            <h1>Job Title Sync</h1>

            <form method="post" name="myUpload" id="myUpload" enctype="multipart/form-data" runat="server">
                <asp:Label ID="Label3" runat="server" Text="Error Log"></asp:Label>
                <div class="formContent">

                    <label>Upload Job Titles Excel File:</label>

                    <br />

                    <asp:FileUpload ID="FileUpload1" runat="server" />

                    <br />
                    <asp:Button ID="Submit" runat="server" Text="Submit" />

            <form method="get" name="resultsForm" id="resultsForm" >
                <div id="resultsList">
                    <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
        <script src="Scripts/jquery-2.1.1.js"></script>
        <script src="ShadowBox/shadowbox.js"></script>   
        <script src="Scripts/Application.js"></script>

Behind code generating table -

    Private Sub Display_Results(ByVal results As DataTable)

        Dim sb As New StringBuilder
        Dim i As Integer = 1
        Dim rowCount As Integer = results.Rows.Count
        Dim listResults As String = ""

        listResults = sb.Append("<table class='resultstable'>").ToString

        For Each dr As DataRow In results.Rows

            listResults = sb.Append("<tr class='resultsrow'>").ToString
            listResults = sb.Append("<td class='firstname' data-first='" & results.Rows.Item(i)(0).ToString() & "'>" & results.Rows.Item(i)(0).ToString() & "</td>").ToString
            listResults = sb.Append("<td class='lastname' data-last='" & results.Rows.Item(i)(1).ToString() & "'>" & results.Rows.Item(i)(1).ToString() & "</td>").ToString
            listResults = sb.Append("<td class='jobtitle' data-jt='" & results.Rows.Item(i)(2).ToString() & "'>" & results.Rows.Item(i)(2).ToString() & "</td>").ToString
            listResults = sb.Append("<td class='hrid' data-hrid='" & results.Rows.Item(i)(3).ToString() & "'>" & results.Rows.Item(i)(3).ToString() & "</td>").ToString
            listResults = sb.Append("<td class='intrantid' data-intid='" & results.Rows.Item(i)(4).ToString() & "'>" & results.Rows.Item(i)(4).ToString() & "</td>").ToString
            listResults = sb.Append("<td class='status' data-status='" & results.Rows.Item(i)(5).ToString() & "'>" & results.Rows.Item(i)(5).ToString() & "</td>").ToString
            listResults = sb.Append("</tr>").ToString

            i += 1
            If i = rowCount Then
                Exit For
            End If


        listResults = sb.Append("</table>").ToString

        PlaceHolder1.Controls.Add(New LiteralControl(listResults))

    End Sub