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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:06:55+00:00 2026-05-24T14:06:55+00:00

ok should be an easy one for everyone,… i am calling a javascript function

  • 0

ok should be an easy one for everyone,…
i am calling a javascript function in the tag of a button using inclick. Im trying to get that function to have three different parameters. The function then submits three different times, which should end up being three different records in a ruby table.
But i cant see why this doesnt work…

<script>
function submiteffort( elem )
{
    // Elem 1
    $("#effort_hours").val( $( elem ).val() );
    $("#task_id").val( elem.id );
    $("#effort_form").submit();
    return true;  
}

function medium( leave, toil, sick)
{
    var dave = submiteffort(document.getElementsByName(leave));

    if(dave == true){
        var dave2 = submiteffort(document.getElementsByName(toil));
    }

    if(dave2 == true){
        submiteffort(document.getElementsByName(sick));
    }
}
</script>

<div class="startleft">
    <table>
        <tr>
            <td>Leave</td>
            <td><input class="dayinput" type="text" name="Leave" placeholder="0" ></td>
        </t>
        <tr>
            <td>TOIL</td>
            <td><input class="dayinput" type="text" name="TOIL" placeholder="0"></td>
        </tr>
        <tr>
            <td>Sick</td>
            <td><input class="dayinput" type="text" name="Sick" placeholder="0"></td>
        </tr>
        <tr>
            <td>Total</td>
            <td><input id="total" class="total_low" type="text" value="0" disabled="" name="Dave">
        </tr>
        <tr>
            <td></td>
        <td><button onclick="medium('Leave','TOIL','Sick')">Commit</button></td>
        </tr>
    </table>
    </div>

For some reason this only submits 1 record into the table and i cant figure out why.

  • 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-24T14:06:55+00:00Added an answer on May 24, 2026 at 2:06 pm

    Well if you submit the form, the page refreshes, and the other 2 function calls don’t execute. You’d have to use AJAX to send data to the backend in 3 separate function calls.

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

Sidebar

Related Questions

This should be an easy one. How to write a jquery function that gets
Should be an easy one. I'm working on Scala trying to handle long sequences
argh, this should be an easy one. How can I set the directory that
This should be easy one, I just haven't found any reference to that.
This should be an easy one. How do I apply a function to a
This should be an easy one for someone... I had a function in a
This should be any easy one for you. I have an accordion that I'd
This should be an easy one. I have a variable that I've already declared
This should be an easy one: I am creating a program that spawns a
Hey everyone, I had a quick question that should be easy for someone who

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.