I am reading a membership tutorial from ASP.NET
I am currently at the step titled:
Customizing the CreateUserWizard’s Interface to Prompt for the New
User’s Home Town, Homepage, and Signature
What is supposed to happen is that I add a custom "step" to my CreateUserWizard, but when I run through this custom Step and hit "Continue", the values are NOT inserted into my Database, and if something is going wrong, then it should insert "NULL" into the database (as the tutorial tells, "if the user closes the registration during step 2, it will automatically insert NULL", but even that doesn't happen.
My database have 1 relation from UserProfiles_Id to Aspnet_Users_UserId:
FK_UserProfiles_aspnet_Users
I have gone through the steps in the tutorial serval times and I am still unable to find the problem.
Aspx.:
<asp:CreateUserWizard ID="NewUserWizard" runat="server" ContinueDestinationPageUrl="~/bruger/info.aspx">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep" runat="server">
</asp:CreateUserWizardStep>
<asp:WizardStep ID="UserSettings" runat="server" StepType="Step" Title="Dine Informationer">
<p>Navn:<br />
<asp:TextBox ID="Name" runat="server" TextMode="SingleLine" />
</p>
<p>Adresse:<br />
<asp:TextBox ID="Adress" Columns="40" runat="server" TextMode="SingleLine" />
</p>
<p>Postnummer:<br />
<asp:TextBox ID="ZipCode" Columns="20" Rows="5" runat="server" TextMode="SingleLine" />
</p>
<p>By:<br />
<asp:TextBox ID="City" Columns="40" runat="server" TextMode="SingleLine" />
</p>
</asp:WizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server" >
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
Aspx.cs:
protected void NewUserWizard_ActiveStepChanged(object sender, EventArgs e)
{
// Have we JUST reached the Complete step?
if (NewUserWizard.ActiveStep.Title == "Complete")
{
WizardStep UserSettings = NewUserWizard.FindControl("UserSettings") as
WizardStep;
// Programmatically reference the TextBox controls
TextBox Name = UserSettings.FindControl("Name") as TextBox;
TextBox Adress = UserSettings.FindControl("Adress") as TextBox;
TextBox ZipCode = UserSettings.FindControl("ZipCode") as TextBox;
TextBox City = UserSettings.FindControl("City") as TextBox;
// Update the UserProfiles record for this user
// Get the UserId of the just-added user
MembershipUser newUser = Membership.GetUser(NewUserWizard.UserName);
Guid newUserId = (Guid)newUser.ProviderUserKey;
// Insert a new record into UserProfiles
string connectionString =
ConfigurationManager.ConnectionStrings["LLCateringConnectionString"].ConnectionString;
string updateSql = #"UPDATE UserProfiles SET Name = #Name, Adress = #Adress, ZipCode = #ZipCode, City = #City
WHERE UserId = #UserId";
using (SqlConnection myConnection = new SqlConnection(connectionString))
{
myConnection.Open();
SqlCommand myCommand = new SqlCommand(updateSql, myConnection);
myCommand.Parameters.AddWithValue("#Name", Name.Text.Trim());
myCommand.Parameters.AddWithValue("#Adress", Adress.Text.Trim());
myCommand.Parameters.AddWithValue("#ZipCode", ZipCode.Text.Trim());
myCommand.Parameters.AddWithValue("#City", City.Text.Trim());
myCommand.Parameters.AddWithValue("#UserId", newUserId);
myCommand.ExecuteNonQuery();
myConnection.Close();
}
}
}
Try to change the line
if (NewUserWizard.ActiveStep.Title == "Complete")
to
if (NewUserWizard.ActiveStep == this.CompleteWizardStep1)
Related
I'm trying to create a Forgot password page, that verify the user's username, email, security question and answer, before sending them to the new password page. The code below is the onClick that redirect user to the new password page.
protected void SubmitButton_Click(object sender, EventArgs e)
{
string email = Email.Text;
string user = UserName.Text;
string question = Question.Text;
string answer = Answer.Text;
string strCon = ConfigurationManager.ConnectionStrings["WebConfigConString"].ConnectionString;
SqlConnection con = new SqlConnection(strCon);
con.Open();
string strCheck = "SELECT * FROM ACCOUNT WHERE ID = #id AND EMAIL = #email AND SECURITYQUESTION = #question AND SECURITYANSWER = #answer";
SqlCommand cmdCheck = new SqlCommand(strCheck, con);
cmdCheck.Parameters.AddWithValue("#id", user);
cmdCheck.Parameters.AddWithValue("#question", question);
cmdCheck.Parameters.AddWithValue("#email", email);
cmdCheck.Parameters.AddWithValue("#answer", answer);
SqlDataReader dtrCheck = cmdCheck.ExecuteReader();
if (dtrCheck.HasRows)
{
Response.Redirect("newPassword.aspx?id=" + user);
}
else
{
ErrorMsg.Text = "Invalid username or email / question and answer does not match!";
}
}
And this code below is the form segment of the aspx page for newPassword.
<form runat="server">
<div class="form-group">
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">
Password:</asp:Label>
<asp:TextBox class="form-control form-control-user" ID="Password" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
ErrorMessage="Password is required." ForeColor="Red">*</asp:RequiredFieldValidator>
</div>
<div class="form-group">
<asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">
Confirm Password:</asp:Label>
<asp:TextBox class="form-control form-control-user" ID="ConfirmPassword" runat="server" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="ConfirmPasswordRequired" runat="server" ControlToValidate="ConfirmPassword"
ErrorMessage="Confirm Password is required." ForeColor="Red">*</asp:RequiredFieldValidator>
<asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password"
ControlToValidate="ConfirmPassword" ErrorMessage="The Password and Confirmation Password must match." ForeColor="Red">*</asp:CompareValidator>
</div>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" />
<asp:Button ID="SubmitButton" runat="server" Text="Confirm" class="btn btn-primary btn-user btn-block" OnClick="SubmitButton_Click"/>
</form>
And this is the codebehind onclick function for newPassword:
protected void SubmitButton_Click(object sender, EventArgs e)
{
string id = Request.QueryString["id"];
string password = Password.Text;
string strCon = ConfigurationManager.ConnectionStrings["WebConfigConString"].ConnectionString;
using (SqlConnection con = new SqlConnection(strCon))
{
con.Open();
string strChange = "UPDATE ACCOUNT SET PASSWORD = #password WHERE ID = #id";
SqlCommand cmdChange = new SqlCommand(strChange, con);
cmdChange.Parameters.AddWithValue("#id", id);
cmdChange.Parameters.AddWithValue("#password", password);
cmdChange.ExecuteNonQuery();
con.Close();
Response.Redirect("login.aspx?msg=Password updated successfully!");
}
}
However, whenever I click submit after filling out the new password, it freeze for a long time then display this error :
System.ComponentModel.Win32Exception: The wait operation timed out error
Apparently, I forgot to close the connection before redirecting the user to the newPassword.aspx, simply add a con.Close() before redirecting worked for me.
I am developing an asp.net page with two DropDown List populating values from the same table in the Database where a user is required to select account name and I would like the second DropDown List to automatically populates it's own values (Acount Code) sharing the same Account name based on the First dropdown list selection. Here is my sample code ...
<span class="label">
<asp:Label ID="Label2" runat="server" Text="Account Name"</asp:Label>
</span>
<asp:DropDownList ID="name" runat="server"></asp:DropDownList><br />
<span class="label">
<asp:Label ID="Label3" runat="server" Text="Account Code"></asp:Label>
</span>
<asp:DropDownList ID="code" runat="server"></asp:DropDownList>
and my C# code is as follow ..
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string CS = ConfigurationManager.ConnectionStrings["connection"].ConnectionString;
using (SqlConnection conn = new SqlConnection(CS))
{
SqlCommand comm = new SqlCommand("SELECT AccountName, AccountCode FROM Account", conn);
conn.Open();
name.DataSource = comm.ExecuteReader();
name.DataTextField = "AccountName";
name.DataValueField = "AccountName";
name.DataBind();
conn.Close();
if(name.Text != null)
{
conn.Open();
SqlCommand com = new SqlCommand("SELECT AccountCode FROM Account WHERE AccountName= '" + name.Text +"'", conn);
code.DataSource = com.ExecuteReader();
code.DataTextField = "AccountCode ";
code.DataValueField = "AccountCode ";
code.DataBind();
}
}
}
}
In my case if i Change the Values of Account Name, the Account Code does not change automatically. How can i make that happen ..? Thank you
to meet your requirements you will have to add two attributes to your first drop down (1) "AutoPostBack" and (2) "OnSelectedIndexChanged".
1) Autopostback will cause a postback when you select an item in the dropdown.
2) OnSelectedIndexChanged is an event you will have to code to fill the second dropdown.
<asp:DropDownList ID="name" runat="server" AutoPostBack="true" OnSelectedIndexChanged="name_SelectedIndexChanged"></asp:DropDownList>
I'm having trouble exiting edit mode after performing an insert. Inserting isn't done through radgrid but passively through the code behind. I tried everything but I can't exit after completing the insert.
protected void btnInsertUpdate_Click(object sender, EventArgs e)
{
RadButton btnInsert = (RadButton)sender;
RadTextBox txtVisited = (RadTextBox)btnInsert.Parent.FindControl("txtVisited");
RadTextBox txtDays = (RadTextBox)btnInsert.Parent.FindControl("txtDays");
if (txtVisited.Text != "" & txtDays.Text != "" & !IsAsync)
{
string RECORD_UID = ds_01.InsertParameters["RECORD_UID"].DefaultValue;
string VISITED = txtVisited.Text;
string DAYS_ON_SITE = txtDays.Text;
DB db = new DB();
SqlCommand cmd = new SqlCommand();
db.ActiveDBConn = "dbConnection";
cmd.CommandText = "ACP_CANADA_INSERT_NEW_RECORD_DETAILS";
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("UID", RECORD_UID);
cmd.Parameters.AddWithValue("VISITED", VISITED);
cmd.Parameters.AddWithValue("DAYS_ON_SITE", DAYS_ON_SITE);
db.SQLStatement = cmd;
db.NonQuery();
radgrid_1.MasterTableView.ClearEditItems();
}
}
<EditFormSettings EditFormType="Template" FormStyle-BackColor="#e1eaff" FormStyle-BorderColor="#006699" FormStyle-BorderWidth="10">
<FormTemplate>
<div style="padding: 10px;">
<div>
<telerik:RadLabel ID="lblVisited" runat="server" Text="Visited:"></telerik:RadLabel>
<telerik:RadTextBox ID="txtVisited" runat="server"></telerik:RadTextBox>
<br />
<br />
<telerik:RadLabel ID="lblDays" runat="server" Text="Days on Site:"></telerik:RadLabel>
<telerik:RadTextBox ID="txtDays" runat="server"></telerik:RadTextBox>
</div>
<br />
<br />
<telerik:RadButton id="btnInsertUpdate" runat="server" Text="Insert" OnClick="btnInsertUpdate_Click"></telerik:RadButton>
<telerik:RadButton id="btnCancel" text="Cancel" runat="server" causesvalidation="False" CommandName="Cancel"></telerik:RadButton>
</div>
</FormTemplate>
</EditFormSettings>
Adding the CommandName equal to "Cancel" gives me the behavior I'm looking for...Insert is performed to the database and I get to exit out of edit mode.
<telerik:RadButton id="btnInsert" runat="server" Text="Insert" OnClick="btnInsert_Click" CommandName="Cancel"></telerik:RadButton>
I have a function that checks the database to see if the current user is a primary user (this value is called "Type" in the database and is a bit value of 1 or 0--a primary user has a Type of 1) and if the address in the address listing is a billing address (which is represented by the "IsBilling" value in the database which is also a bit value of 0 or 1. If the address is a billing address, then the IsBilling value is 1. If the address is a shipping address, then the value is 0).
What I am trying to do is to show the edit address button ONLY to those users who are primary users--otherwise, it should be hidden. I don't want to hide the edit button for the shipping addresses, though.
Right now, I can't seem to target the billing address--Whenever I set the bool variable ShowButton to true or false, this ends up applying to all the edit buttons.
I checked the SELECT query in the database and it does bring back all the correct values based on the current user id. But I am not sure why I can't choose when to show/hide the button for the Billing Address.
This is the function:
protected bool ShowButton(int UserId)
{
bool ShowButton = false;
try
{
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["AbleCommerce"].ToString()))
{
cn.Open();
SqlCommand cmd = new SqlCommand("SELECT Type, IsBilling FROM CustomerUsers INNER JOIN Addresses ON uidUser = Addresses.UserId WHERE uidUser = #UserId", cn);
cmd.Parameters.Add(new SqlParameter("#UserId", UserId));
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
if (Convert.ToInt16(reader["Type"]) == 0 && Convert.ToInt16(reader["IsBilling"]) == 1)
{
ShowButton = false;
}
}
}
cn.Close();
}
}
catch (Exception ex)
{
Response.Write("ERROR: " + ex.Message.ToString() + "<br />");
}
return ShowButton;
}
This is the repeater with the EditAddressButton:
<asp:Repeater ID="ShipToAddressList" runat="server" OnItemCommand="ShipToAddressList_ItemCommand" >
<ItemTemplate>
<div class="entry aEntry" >
<div class="caption">
<h2><asp:Literal ID="AddressCaption" runat="server" Text='<%#((bool)Eval("IsBilling"))?"Billing Address":"Shipping Address" %>'></asp:Literal></h2>
<span class="links">
<asp:LinkButton ID="EditAddressButton" runat="server" CommandArgument='<%#Eval("AddressId")%>' Visible = '<%# ShowButton(Convert.ToInt32(Eval("UserId"))) %>' CommandName="Edit" CssClass="link"><asp:Image ID="Image1" ImageUrl="/app_themes/cartbuttons/btn_Edit.jpg" runat="server" /></asp:LinkButton><%-- --%>
<br />
<asp:LinkButton ID="DeleteAddressButton" runat="server" CommandArgument='<%#Eval("AddressId")%>' CommandName="Del" Visible='<%#!((bool)Eval("IsBilling")) %>' OnClientClick="return confirm('Are you sure to delete this address?');" CssClass="link" ><asp:Image ID="Image2" ImageUrl="/app_themes/cartbuttons/btn_Delete.jpg" runat="server" /></asp:LinkButton>
</span>
</div>
<div class="address">
<asp:Literal ID="Address" runat="server" Text='<%#Container.DataItem.ToString()%>'></asp:Literal>
<br /><asp:Literal ID="phoneAndEmail" runat="server" Text='<%# getPhoneAndEmail(AlwaysConvert.ToInt(Eval("AddressId"))) %>'></asp:Literal>
</div>
<div class="buttons">
<br /><br />
<asp:LinkButton ID="PickAddressButton" runat="server" SkinID="Button" CommandName="Pick" CommandArgument='<%#Eval("AddressId")%>' CssClass="button"><asp:Image ID="ImagePick" runat="server" ImageUrl="/app_themes/cartbuttons/btn_Ship.jpg" /></asp:LinkButton>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
I am working on a small search form that has two text fields: One that allows users to search for a job list (which is basically a wish list--don't know why they want to call it a "job list" but whatever) by entering in part of or a full email address or someone's first and/or last name (This textbox is called SearchName). This field is required and if it is blank when the user hits "Search," an error message appears telling them so. The second textbox is optional, and it allows users to enter in a city or a state to help narrow their search down even more (this textbox is called SearchLocation).
I have a function (called getJobLists()) that is used by the search button to get results.
As it is right now, the part of the function that returns results based on what is entered into the SearchName field works perfectly. However, I cannot get any results for SearchLocation. When I enter a valid email or name into SearchName, then enter a valid city or state into SearchLocation, I get no results. However, if I enter in anything invalid (i.e. a city that is not associated with the entered email or name) the "no results found" message does appear.
I have tested both SQL queries in my search function in SQL Server Management Studio and they do work perfectly.
I have a try-catch inside the search function, but no error is being shown, not even in the console.
This is the code behind:
protected void Page_Load(object sender, System.EventArgs e)
{
// CHECK IF THE WISHLIST SEARCH ENABLED
StoreSettingsManager settings = AbleContext.Current.Store.Settings;
if (!settings.WishlistSearchEnabled)
{
Response.Redirect(AbleCommerce.Code.NavigationHelper.GetHomeUrl());
return;
}
}
protected void getJobLists()
{
try
{
if (SearchName.Text != "")
{//if SearchName.Text is not blank
if (SearchLocation.Text != "")
{//check to see if SearchLocation.Text is not blank either
string sqlSelect = "SELECT (FirstName +' '+ LastName) AS 'FullName', UserName, (Address1 + ', ' +City + ', ' + Province) AS 'Address' FROM ac_Users INNER JOIN ac_Wishlists ON ac_Wishlists.UserId = ac_Users.UserId INNER JOIN ac_Addresses ON ac_Addresses.UserId = ac_Wishlists.UserId WHERE IsBilling ='true' AND (UserName LIKE '%'+#UserName+'%' OR (FirstName + LastName) LIKE '%'+#UserName+'%') AND ((City + Province) LIKE '%'+#Location+'%')";
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["AbleCommerce"].ToString()))
{
SqlCommand cmd = new SqlCommand(sqlSelect, cn);
cmd.Parameters.AddWithValue("#UserName", String.Format("%{0}%", SearchName.Text));
cmd.Parameters.AddWithValue("#Location", String.Format("%{0}%", SearchLocation.Text));
cmd.CommandType = CommandType.Text;
cn.Open();
DataSet ds = new DataSet();
DataTable jobsListsTbl = ds.Tables.Add("jobsListsTbl");
jobsListsTbl.Columns.Add("User", Type.GetType("System.String"));
jobsListsTbl.Columns.Add("PrimaryAddress", Type.GetType("System.String"));
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
DataRow dr = jobsListsTbl.NewRow();
dr["User"] = reader["Name"];
dr["PrimaryAddress"] = reader["Address"];
jobsListsTbl.Rows.Add(dr);
}
}
WishlistGrid.DataSource = ds;
WishlistGrid.DataMember = "jobsListsTbl";
WishlistGrid.DataBind();
}
}//end of if(SearchLocation.Text !='')
else
{//if SearchLocation.Text is blank, then go with this code instead
string sqlSelect2 = "SELECT (FirstName +' '+ LastName) AS 'FullName', UserName, (Address1 + ', ' +City + ', ' + Province) AS 'Address' FROM ac_Users INNER JOIN ac_Wishlists ON ac_Wishlists.UserId = ac_Users.UserId INNER JOIN ac_Addresses ON ac_Addresses.UserId = ac_Wishlists.UserId WHERE IsBilling ='true' AND (UserName LIKE '%'+#UserName+'%' OR (FirstName + LastName) LIKE '%'+#UserName+'%')";
using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["AbleCommerce"].ToString()))
{
SqlCommand cmd = new SqlCommand(sqlSelect2, cn);
cmd.Parameters.AddWithValue("#UserName", String.Format("%{0}%", SearchName.Text));
cmd.CommandType = CommandType.Text;
cn.Open();
DataSet ds = new DataSet();
DataTable jobsListsTbl2 = ds.Tables.Add("jobsListsTbl2");
jobsListsTbl2.Columns.Add("User", Type.GetType("System.String"));
jobsListsTbl2.Columns.Add("PrimaryAddress", Type.GetType("System.String"));
using (IDataReader reader = cmd.ExecuteReader())
{
while (reader.Read())
{
DataRow dr = jobsListsTbl2.NewRow();
dr["User"] = reader["UserName"];
dr["PrimaryAddress"] = reader["Address"];
jobsListsTbl2.Rows.Add(dr);
}
}
WishlistGrid.DataSource = ds;
WishlistGrid.DataMember = "jobsListsTbl2";
WishlistGrid.DataBind();
}
}//end if SearchLocation.Text is empty
}//end of if SearchName.Text !==''
}
catch (Exception x)
{
errors5.Text += "ERROR: " + x.Message.ToString() + "<br />";
}
}
protected void SearchButton_Click(object sender, EventArgs e)
{
WishlistGrid.Visible = true;
getJobLists();
}
And this is the designer code for the search form (Note: the NavigateUrl is not set for the hyperlink yet. I will set it once everything is displaying properly for the search results):
<div id="findWishlistPage" class="mainContentWrapper">
<div class="section">
<div class="introDiv">
<div class="pageHeader">
<h1>Find a Job List</h1>
</div>
<div class="content">
<asp:label id="errors" runat="server" text=""></asp:label>
<asp:label id="errors2" runat="server" text=""></asp:label>
<asp:label id="errors3" runat="server" text=""></asp:label>
<asp:label id="errors4" runat="server" text=""></asp:label>
<asp:label id="errors5" runat="server" text=""></asp:label>
<asp:UpdatePanel ID="Searchajax" runat="server">
<ContentTemplate>
<asp:Panel ID="SearchPanel" runat="server" EnableViewState="false" DefaultButton="SearchButton">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableViewState="false" />
<table class="inputForm">
<tr>
<th class="rowHeader">
<asp:Label ID="SearchNameLabel" runat="server" Text="Name or E-mail:" AssociatedControlID="SearchName" EnableViewState="false"></asp:Label>
</th>
<td>
<asp:Textbox id="SearchName" runat="server" onfocus="this.select()" Width="200px" EnableViewState="false"></asp:Textbox>
<asp:RequiredFieldValidator ID="SearchNameValdiator" runat="server" ControlToValidate="SearchName"
Text="*" ErrorMessage="Name or email address is required." EnableViewState="false"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<th class="rowHeader">
<asp:Label ID="SearchLocationLabel" runat="server" Text="City or State (optional):" EnableViewState="false"></asp:Label>
</th>
<td>
<asp:TextBox id="SearchLocation" runat="server" onfocus="this.select()" Width="140px" EnableViewState="false"></asp:TextBox>
<asp:LinkButton ID="SearchButton" runat="server" CssClass="button linkButton" Text="Search" OnClick="SearchButton_Click" EnableViewState="false" />
</td>
</tr>
</table><br />
<asp:GridView ID="WishlistGrid" runat="server" AllowPaging="True"
AutoGenerateColumns="False" ShowHeader="true"
SkinID="PagedList" Visible="false" EnableViewState="false">
<Columns>
<asp:TemplateField HeaderText="Name">
<HeaderStyle CssClass="wishlistName" />
<ItemStyle CssClass="wishlistName" />
<ItemTemplate>
<asp:HyperLink ID="WishlistLink" runat="server" >
<%#Eval("User")%>
</asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Location">
<HeaderStyle CssClass="wishlistLocation" />
<ItemStyle CssClass="wishlistLocation" />
<ItemTemplate>
<asp:Label ID="Location" runat="server" Text='<%#Eval("PrimaryAddress")%>'></asp:Label>
<%--'<%#GetLocation(Eval("User.PrimaryAddress"))%>'--%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<asp:Localize ID="EmptySearchResult" runat="server" Text="There were no job lists matching your search criteria."></asp:Localize>
</EmptyDataTemplate>
</asp:GridView>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
Can anyone please tell me what I'm missing or doing wrong?
Okay, I finally solved the issue. Apparently, it was a variable naming issue I kept overlooking. But now it all works okay! :)