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 8288859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:22:00+00:00 2026-06-08T12:22:00+00:00

I had this JavaScript running for a while but I altered it a slight

  • 0

I had this JavaScript running for a while but I altered it a slight bit and now I cant get it to even run. I had an alert in the JavaScript for a while and I couldn’t even get that to trigger. There is some PHP above this code but it shouldn’t interfere with the JavaScript.

<form action="http://go.gbpi.net/Outage/add-question/" method="post">
Question Name (A descriptive name for the question. Example: "Phone number", or "Pizza Size"): <br /><input type="text" name="questionName" />
<?php
echo("Category: <br /><select name=\"category\" id=\"category\">");
$mysqli = db_init();
$mysqli->next_result();
    $cats = $mysqli->query("call GetActiveCategories()");
    while ($row = $cats->fetch_assoc()){
        $categori = $row['Category_Text'];
        if(!($categori == $category)){
        echo("<option value = \"".$categori."\">".$categori."</option>");}
    }
echo("</select>");
?>
Question Text:<br /><input type="text" name="questionText" style='width:80%' />
Question Type:<br /><select name="myList" id="myList" onchange="selectType(); return false;">
<option value = "1">Yes or No</option>
<option value = "2">Multiple Choice</option>
<option value = "3">Multiple Select</option>
<option value = "4">Open Response</option>
    <option value = "5">Final Reply</option>
    <option value = "6">Summary</option>
</select>
<div id='regexes'>
type of input: <br /><select name="regex" id="regex">
<option value = "-1">any input</option>
<?php
    $mysqli->next_result();
    $regexes = $mysqli->query("call GetValidRegexes()");
    while($regex_row = $regexes->fetch_assoc()){
        $rid = $regex_row['Validation_ID'];
        $rname = $regex_row['Validation_Name'];
        echo("<option value = \"".$rid."\">".$rname."</option>");
    }
?>
</select>
</div>
<div id='buttons'></div>
<button id="adda" onclick="addAnswer(); return false;">add answer (max: 10)</button>
<input type="submit" value="add question" />
</form>
    <?php
            echo("<a href='./define-relationships/'>Define Question Relationships</a><br />");
    ?>
<script type="text/javascript">
    document.getElementById("adda").style.visibility="hidden";
</script>

<script type="text/javascript">
var answers = 0;
var inHTML = "";
function addAnswer()
{
if(answers < 10){
write = document.getElementById('buttons');
write.innerHTML = write.innerHTML + "answer: <input type=\"text\" name=\"answer" + answers + "\" /> <br>";
answers = answers + 1;}
}
</script>

<script type="text/javascript">
function selectType()
{
alert("HAHA I HATE YOU!");
var type=document.getElementById("myList").value;
if(type == "2" || type == "3"){
    document.getElementById("buttons").style.visibility="visible";
    document.getElementById("adda").style.visibility="visible";
    document.getElementById("regexes").style.visibility="hidden";
}
else if(type == "4"{
    document.getElementById("buttons").style.visibility="hidden";
    document.getElementById("adda").style.visibility="hidden";
    document.getElementById("regexes").style.visibility="visible";
}
else{
    document.getElementById("buttons").style.visibility="hidden";
    document.getElementById("adda").style.visibility="hidden";
    document.getElementById("regexes").style.visibility="hidden";
}}
</script>
  • 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-06-08T12:22:02+00:00Added an answer on June 8, 2026 at 12:22 pm

    Without a jsfiddle it’s hard to know for sure if this is the problem, but you have a syntax error in the last script on the page.

    else if(type == "4"{
    

    Add the closing paren and see if that helps.

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

Sidebar

Related Questions

I had this nasty bug that disappeared in the past but now after quite
For a while I had been running JavaScript component initialization by waiting for the
Had this working; at one stage. The problem is the following text is now
I had this weird problem a little while ago and haven't been able to
I had this doubt for sometime now, some people say that there's no such
I had this problem some time ago and I gave up but lately it
Sounds nit picky but this had me hung up for about an hour or
I've had a javascript running for quite som time and I've never experienced any
I had my Google map running just fine. I've been trying to get only
I previously had this problem with an external file not running. I fixed this

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.