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

  • SEARCH
  • Home
  • 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 7487879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T14:40:50+00:00 2026-05-29T14:40:50+00:00

if(ns1 == ” && ns2 == ”) is empty than user will get this

  • 0

if(ns1 == '' && ns2 == '') is empty than user will get this warning Please fill in both nameserver when user click submit button. I want to fade out the warning when user click ns1 textbox and start typing. How could I achieve that? Help me please? Thank you.

 <script type="text/javascript">
$(document).ready(function(){

        $('#submitButton').click(function(){

                var rege = /^([a-z0-9][a-z0-9-]*\.)+[a-z]{2,3}\.$/i;


        var zone = $('#zone').val();
        var nama_subdomain = $('#nama_subdomain').val();
        var ns1 = $('#ns1').val();
        var ns2 = $('#ns2').val();

if(ns1 == '' && ns2 == ''){
$('#display').html('Please fill in both nameserver'); 
$("#ns1").focus();
return false;
} 

if(ns1 == ''){
$('#display').html('Please fill in nameserver 1'); 
$("#ns1").focus();
     return false; 
} 
else if(ns2 == ''){
$('#display').html('Please fill in nameserver 2'); 
$("#ns2").focus();
     return false; 
} 

var parts = ns1.split('.');
var parts2 = ns2.split('.');

if (parts.length < 3 || !rege.test(ns1)) 
{ $('#display').html('Invalid nameserver 1 format'); 
$("#ns1").focus();
return false;
}
else if (parts2.length < 3 || !rege.test(ns2)) 
{ $('#display').html('Invalid nameserver 2 format'); 
$("#ns2").focus();
return false;
}


        $('#display').html('<img src="http://i.imgur.com/UbMeQ.gif"> saving...');
            $.post('pros.php', {
                zone : zone,
                nama_subdomain : nama_subdomain,
                nameserver1 : ns1,
                nameserver2 : ns2
            },
             function(zone) {

           $('#display').html(zone);
             } 
          );


        });
    });


    </script>

The html:

    <label for="data">Nameserver 1</label>
            <input type="text" class="textInput" maxlength="255" size="30" value="" id="ns1" name="nameserver1">


            <label for="data">Nameserver 2</label>
            <input type="text" class="textInput" maxlength="255" size="30" value="" id="ns2" name="nameserver2">

    <div id="display" style="color: green;">

<button id="submitButton" value="Save" type="button"><span>Save</span></button>
  • 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-29T14:40:51+00:00Added an answer on May 29, 2026 at 2:40 pm

    Attach a keypress event handler on that condition which will fade out the message and then unbind it once the user types anything.

    if(ns1 == '' && ns2 == ''){
       $('#display').html('Please fill in both nameserver'); 
       $("#ns1").focus()
       .unbind('keypress')
       .keypress(function(){
          if(this.value != ''){
             //fade out the message
             $('#display').fadeOut();
    
             //unbind the keypress event we don't need it now
             $(this).unbind('keypress');
          }
       });
       return false;
    }
    

    Do the same for other textbox.

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

Sidebar

Related Questions

declare function tns:getDt($inp as xs:string) as element(ns1:Sschema)*{ let $primary := fn-bea:get-property('PRIMARY','1') let $sec :=
I'm using the an API, and I get this kind of response: <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'>
I'm seeing two problems in a setup like this: namespace ns1 { class ParentClass
This probably will sound a strange question: If I would like to do a
I was trying to delete ns1.something.com and ns2.somthing.com records from the DNS functions using
I want to store hierarchial data like: d1 -> { ns1 -> {ip1,ip2}, ns2
This regex currently accept dot at the end of nameserver. What I need is:
I have the following paths: /my:company/ns1:Audit/ns1:Visit/ns1:customField10 /my:company/ns1:Audit/ns1:Visit/ns1:accountNumber I want to select ns1:customField10 if it
How can I generate XML with the following schema using JAXB. <NS1:getRatesResponse xmlns:NS1="http://mynamespaceTypes"> <response>
Functionally, the two blocks should be the same <soapenv:Body> <ns1:login xmlns:ns1=urn:soap.sof.com> <userInfo> <username>superuser</username> <password>qapass</password>

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.