Jump to content

two script files

Recommended Posts


I have a code in which i am running a script for drop-down list to show only the selected drop-down content as shown in attached file.

I need to add one more script file for alerting a warning for unselected  drop-down list as shown below

<input type="submit" value="submit" onclick="return Validate()" />
<script >
    function Validate() {
        var abc = document.getElementById("opts");
        if (abc.value == "") {
            //If the "Please Select" option is selected display error.
            alert("Please select an option!");
            return false;
        return true;
How can i merge two script files or anyway to call both files
Please suggest
Thanks and Regards
Rizwan Syed

adding one more script file.txt

Share this post

Link to post
Share on other sites

Thanks for the reply.

I didnt get exactly what u mean to say but i tried 

                        <form action="/action_page.php" method="post" autocomplete="off" onsubmit="Validate()">
with two script files but didnt get it work.


Can you just explain once again

Share this post

Link to post
Share on other sites

Placing onsubmit on the form element ONLY! Will capture ALL form submission achieved by clicking any button that acts like a type submit, or a non 'required' input/s where a user will press the keyboards 'Enter' key while in the input, that will trigger a submission event. So to properly validate using a validation function whenever a submission occurs it should run by the onsubmit event that is always applied to the form element and nowhere else.

Edited by dsonesuk

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...