malcolm p 0 Newbie Poster

I have a spinner where user enters in their value or uses the buttons to increase or decrease the value. When the user is happy with the value in the spinner the user submits the value. The value would then appears in another table inside a textbox.

What my question is, is that how can I get it so that when user submits value in the other table that the spinner buttons are also displayed in the other table so that except the value is in a textbox, it is displayed in a spinner which operates exactly the same as the spinner in the previous table?

Below is code where the value from the first spinner is retireved and oututted into another table into a textbox:

function insertQuestion(form) {   
    	var row = document.createElement("tr");
    	var cell,
            alertErrors = "",
            qnum = 1;
         cell = document.createElement("td");
         cell.className = "weight";
         input = document.createElement("input"); = "weight_" + qnum;
         input.onkeypress = "return isNumberKey(event)";
         input.value = form.textWeight.value;

Below is html code which shows 3 tables, first table is where the user enters in the value of the answer weight in the spinner, second table is the submit button (Add Question) and third table is where the value is displayed after submission of the first spinner.

<form id="enter" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post" onsubmit="return validateForm(this);" >
    <div id="detailsBlock">
    <table id="answerWeight">
         <th colspan="3">
         Answer Weight
    <td class="spinner">Weight: <input type="text" class="spinnerWeight" name="textWeight" id="txtWeight" />%</td>
    <td><button class="scrollBtn" id="btnWeightUp" type="button"><img src="Images/black_uppointing_triangle.png" alt="Increase" /></button>
    <button class="scrollBtn" id="btnWeightDown" type="button"><img src="Images/black_downpointing_triangle.png" alt="Decrease" /></button></td>
    <table id="questionBtn" align="center">
    <input id="addQuestionBtn" name="addQuestion" type="button" value="Add Question" onClick="insertQuestion(this.form)" />
    <table id="qandatbl" border="1">
        <th class="qid">Question No</th>
        <th class="question">Question</th>
        <th class="option">Option Type</th>
        <th class="answer">Answer</th>
        <th class="weight">Weight</th>

Hoefully that is all the information you require. If you want more information then just add a comment to me. Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.