Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 623125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:03:31+00:00 2026-05-13T19:03:31+00:00

I have the following dynamically created HTML block: <form class=standard settingsPage method=post enctype=multipart/form-data name=account

  • 0

I have the following dynamically created HTML block:

<form class="standard settingsPage" method="post" enctype="multipart/form-data" name="account" style="background-color: rgb(61, 80, 133);">
<h2>Add New Account</h2>
<p>
<label class="" disabled="true">E-mail address:</label>
<input id="accountEmailAddress" class="" type="text" value="" name="accountEmailAddress"/>
</p>
<p>
<label class="" for="accountEmailPassword">Password:</label>
<input id="accountEmailPassword" type="password" name="accountEmailPassword"/>
</p>
<p class="submit">
<input type="button" onclick="checkEmailSettings();" value="Send" name="submit"/>
</p>
<p>
<label>Mail Server:</label>
<input id="mail2server" type="text" name="mail2server"/>
</p>
<p>
<label>Mail Type:</label>
<select id="mail2type" name="mail2type">
</select>
</p>
<p>
<label>Mail Security:</label>
<select id="mail2security" name="mail2security">
</select>
</p>
<p>
<label>Mail Server Port:</label>
<input id="mail2port" type="text" name="mail2port"/>
</p>
<p>
<label>Mail Username:</label>
<input id="mail2username" type="text" name="mail2username"/>
</p>
<p class="submit">
<input id="mailsend" type="button" name="mailsend" onclick="checkEmailSettings();" value="Send"/>
</p>
</form>

Which is appended to an existing form.

However when I do $(‘#mail2server’).val() it returns blank, even if there is something in the box. If I do $(‘#mail2server’).attr(‘name’) it returns the name, so it definitely recognizes that the element exists. Any ideas why this would be failing?

Cheers,
Gazler.

EDIT

function checkEmailSettings()
{
    var emailAddress=$("#accountEmailAddress").val();
    var emailPassword=$("#accountEmailPassword").val();
    var datastring = "emailaddress="+emailAddress+"&emailpassword="+emailPassword;
    if (additionalInfo == 1)
    {
        var mailserver = $("#mail2server").val();
        var mailtype = $("#mail2type").val();
        var mailsecurity = $("#mail2security").val();
        var mailport = $("#mail2port").val();
        var mailusername = $("#mail2username").val();
        alert($("#mail2server").val());
        datastring += "&mailserver="+mailserver+"&mailtype="+mailtype+"&mailsecurity="+mailsecurity+"&mailport="&mailport+"&mailusername="+mailusername;
    }
    $('input[type=text]').attr('disabled', 'disabled');
    $('input[type=password]').attr('disabled', 'disabled');
    $('input[type=button]').attr('disabled', 'disabled');
    $.ajax({
        type: "GET",
        url: "checkemailsettings.php",
        data: datastring,
        async: true,
        cache: false,
        timeout:50000, 

        success: function(data){
        switch(parseInt(data))
        {
                //SNIPPED
        case 4:
         alert("More information needed.");
         if (additionalInfo == 0)
        {
         var string = addTextToForm("Mail Server","mail2server");
         string += addOptionsToForm("Mail Type","mail2type", new Array("IMAP", "POP3"));
         string += addOptionsToForm("Mail Security","mail2security", new Array("NOTLS", "TLS", "SSL"));
         string += addTextToForm("Mail Server Port","mail2port");
         string += addTextToForm("Mail Username","mail2username");
         string += addButtonToForm("Send","mailsend", "checkEmailSettings();");
         alert(string);
         $('form[name=account]').append(string);
         additionalInfo = 1;
        }
          break;
        }
        },
    });
}

    function addTextToForm(strLabel, strID, strVal)
    {
    if (!strVal) {return "<p><label>"+strLabel+":</label><input id=\""+strID+"\" type=\"text\" name=\""+strID+"\" /></p>";}
        return "<p><label>"+strLabel+":</label><input id=\""+strID+"\" type=\"text\" name=\""+strID+"\" value=\""+strVal+"\"/></p>";
    }
    function addButtonToForm(strLabel, strID, functionName)
    {
        return "<p class=\"submit\"><input id=\""+strID+"\" value=\""+strLabel+"\" onclick=\""+functionName+"\" type=\"button\" name=\""+strID+"\"/></p>";
    }

    function addOptionsToForm(strLabel, strID, optionsArr)
    {
        var returnstring="<p><label>"+strLabel+":</label><select id=\""+strID+"\" name=\""+strID+"\">";
        for (i=0; i<optionsArr.length; i++)
        {
            returnstring += "<option>"+optionsArr[i]+"</option>";
        }
        returnstring += "</select></p>";
        return returnstring;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:03:31+00:00Added an answer on May 13, 2026 at 7:03 pm

    The “alert” call says $('#mailserver'), not $('#mail2server')

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let say I have the following desire, to simplify the IConvertible's to allow me
My question is about memory use and objects in actionscript 2. If I have
I have a project that adds elements to an AutoCad drawing. I noticed that
I have a script that appends some rows to a table. One of the
I have a new web app that is packaged as a WAR as part
I have several USB mass storage flash drives connected to a Ubuntu Linux computer
I have a snippet to create a 'Like' button for our news site: <iframe
I have found this example on StackOverflow: var people = new List<Person> { new
I am attempting to pull some information from my tnsnames file using regex. I
After having read Ian Boyd 's constructor series questions ( 1 , 2 ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.