Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Loading new table???Please help - URGENT

    Please give me some suggestions to do. This is really urgent.

    I have a sign up form, which has some values inside when I view the form. For Example: Member’s Name: Steve Smith, Gender: Male, Date of Birth: 12/31/2000.

    If the user wants to Add New Member, what they have to do is click “Add New Member” button, it must load the same table, but no values inside of that table. How can we do that???? ??

    I’ve tried to have 2 tables, but it doesn’t turn out correctly. Because, when I click Update. It submits both values…for example: Member’s Name: Steve Smith, Jenny Smith ----(this is So WRONG)

    Any suggestions will be appreciated. Thank you for help.

    ===CODE-===============

    <html>
    <head>
    <title>Untitled</title>
    </head>

    <body>

    <form action="signup.asp" name="SubmitForm" method="post" onsubmit="AmendmentDate()">
    <table id="table1">
    <tr>
    <td width="30" align="right" class="SmallHeadingBurg">&nbsp;</td>
    <td class="SmallHeadingBurg" align="left" width="180">Member's Name:</td>
    <td class="regularParagraph" align="left">
    <INPUT style="border:1 solid #000000" type="text" id="MemberName" name="MemberName" value="<%= (MemberName) %>" maxlength="30" size="30">
    </td>
    </tr>
    <tr>
    <td width="30" align="right" class="SmallHeadingBurg">&nbsp;</td>
    <td class="SmallHeadingBurg" align="left" width="180">Gender:</td>
    <td class="regularParagraph" align="left">
    <select style="border:1 solid #000000" name="Gender">
    <option value="M">Male</option>
    <option value="F"> Female</option>
    </select>
    </td>
    </tr>
    <tr>
    <td width="30" align="right" class="SmallHeadingBurg">&nbsp;</td>
    <td class="SmallHeadingBurg" width="180">Date of Birth:&nbsp;</td>
    <td class="regularParagraph" align="left">
    <INPUT style="border:1 solid #000000" type="text" id="DateOfBirth" name="DateOfBirth" value="<%= (DateOfBirth) %>">
    &nbsp; <span class="regularParagraph">format: mm/dd/yy</TD>
    </td>
    </tr>
    </table>
    <table>
    <tr>
    <td>
    <INPUT type="submit" value="Add New Member" name="Submit">
    </td>
    </tr>
    </table>
    <table align="center">
    <tr>
    <td>
    <INPUT type="submit" value="Update" name="Submit">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i'm confused.

    you have a form that displays data from a user. OK .and you want to use that form to add a new user ? In the same table ? On the same page ?

    Why not use two pages ? Two different forms. One for registered users (where the data is displayed) and one for new users (were only the formelements and text are displayed ? You could redirect the users to the page that displays the info after his information was inserted.

    Or you could combine this in one multipurpose page. You set a flag, depending on the link that was clicked to reach the page or the result of a selctstatement on your database, or you set a flag at the end of the first parsing of the page.
    And after the second processing, when the new user is inserted, you reset the flag and display the info.


    If you put two tables(with the same formfields) in one form, then the values will be taken together like this
    variable="value1, value2"

    Maybe this happened with you.


    I think you need to give us some more info on what you're exactly trying to do (and how), if you're looking for a quick answer.

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I cannot have another page: Below is the code that I try to update and Add.

    ====Code==========

    <%@ Language=VBScript %>
    <% option explicit %>
    <%
    Select Case Request("Submit") 'requested from a previous page
    Case "Edit"
    If Not IsEmpty(Request.Form("MemberNum")) then
    strMemberNum = Request.Form("MemberNum")
    end if

    Case Else
    End Select
    %>

    <%
    Select Case Ucase(Request("Submit")) 'Name of the Submit Button
    Case "Update" 'Value of the Submit Button

    dim MemberNode

    ErrorMessage = UserInput()

    If ErrorMessage = "" Then

    Set MemberNode = root.selectSingleNode("Member@MemberNum = '" & Request.Form("MemberNum") & "']")
    End If

    Case "Add"
    set itemNode = domDoc.createElement("Member")
    attrNode.nodeValue = strTemp 'assign New number.
    'Add attribute to the Node
    itemNode.attributes.setNamedItem(attrNode)

    'Create an Attribute
    set attrNode = domDoc.createAttribute("MemberName")
    'Assign a value to an Attribute
    attrNode.nodeValue = Request.Form("MemberName")
    itemNode.attributes.setNamedItem(attrNode)

    'Create an Attribute
    set attrNode = domDoc.createAttribute("Gender")
    attrNode.nodeValue = ConvertGenderBack(Request.Form("Gender"))
    itemNode.attributes.setNamedItem(attrNode)

    'Create an Attribute
    set attrNode = domDoc.createAttribute("DateOfBirth")
    attrNode.nodeValue = Request.Form("DateOfBirth")
    itemNode.attributes.setNamedItem(attrNode)


    Case Else 'Display information.

    Set MemberNode = root.selectSingleNode("Member[@MemberNum = '" & Request.QueryString("member") & "']")

    MemberName = MemberNode.attributes.getNamedItem("MemberName").nodeValue
    Gender= MemberNode.attributes.getNamedItem("Gender").nodeValue
    DateOfBirth= MemberNode.attributes.getNamedItem("DateOfBirth").nodeValue
    %>

    <body>

    <form action="signup.asp" name="SubmitForm" method="post" onsubmit="AmendmentDate()">
    <table id="table1">
    <tr>
    <td width="30" align="right" class="SmallHeadingBurg"> </td>
    <td class="SmallHeadingBurg" align="left" width="180">Member's Name:</td>
    <td class="regularParagraph" align="left">
    <INPUT style="border:1 solid #000000" type="text" id="MemberName" name="MemberName" value="<%= (MemberName) %>" maxlength="30" size="30">
    </td>
    </tr>
    <tr>
    <td width="30" align="right" class="SmallHeadingBurg"> </td>
    <td class="SmallHeadingBurg" align="left" width="180">Gender:</td>
    <td class="regularParagraph" align="left">
    <select style="border:1 solid #000000" name="Gender">
    <option value="M">Male</option>
    <option value="F"> Female</option>
    </select>
    </td>
    </tr>
    <tr>
    <td width="30" align="right" class="SmallHeadingBurg"> </td>
    <td class="SmallHeadingBurg" width="180">Date of Birth: </td>
    <td class="regularParagraph" align="left">
    <INPUT style="border:1 solid #000000" type="text" id="DateOfBirth" name="DateOfBirth" value="<%= (DateOfBirth) %>">
    <span class="regularParagraph">format: mm/dd/yy</TD>
    </td>
    </tr>
    </table>
    <table>
    <tr>
    <td>
    <INPUT type="submit" value="Add New Member" name="Submit">
    </td>
    </tr>
    </table>
    <table align="center">
    <tr>
    <td>
    <INPUT type="submit" value="Update" name="Submit">
    </td>
    </tr>
    </table>
    </form>
    <% end select%>
    </body>
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •