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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Loading tables??? 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"> </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>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Wait, so you're using the same form to edit existing user OR add new users?
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    YES, I want to use 1 form ....but handles for both Edit an exisiting member and Add New member

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That should be handled by the ASP, not javascript.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The question is how can we DISABLE the existing value when we click ADD...is that something to do with DHTML or JavaScript.

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm sorry, but I'm just not getting you. I'm trying to follow this process in my mind...

    1) User arrives at page
    2a) if new user, enter info and "Add"
    2b) If not, enter info and update *
    3) Database is updated

    *How the does the ASP recognize the user? I don't see any hidden elements. Is there a click-through first for existing users?

    I mean, both of your buttons are submit buttons, why would you want to disable the new users info just before submitting? Or is 'Add' supposed to go to a different page?

    Is there any particular reason why you'd send new and existing users to the same form? Typically, existing users have a link or something to go modify their info, new users just get a blank form. Now, this CAN be the same form, but the server code (ASP here) handles the logic.

    I'm not just blowing smoke at you, I program in PHP too, so I'm quite familiar with the process.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #7
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    do you remember the question that I asked yesterday about "how to shown 1 table and hidden another table"?
    I applied that process in this case; and it turned that 1 Variable = "value1, value2". So, this is wrong.

    " Now, this CAN be the same form, but the server code (ASP here) handles the logic. " GOOD , but how (I cannot think how to do it)

    My brain is so BLank right now....I cannot think.. how can I handle that in ASP. 1 thing I have in mind is: yes, keep the same form....but how can I disable the exisisting value when I click "ADD" button (Add button is just loading the blank table. Update button handles for both editing and adding new member (meaning, after the user changed something in the existing member then click the Update button..it will update the info...and it does the same thing for adding new member).

    Any other sugguestions?

    Below is my 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>

  • #8
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, I don't code ASP or VB, but I can help you with the logic...but tell me this first. When a user edits his/her info, HOW ON EARTH do you plan on identifying that it is an existing user? I mean, there's got to be a user ID, right? An existing user can't just go to a form and update their information without the page knowing their user id BEFORE they enter new info.

    Do existing user's "login" so the asp page receives their ID via a session or something? (Like I said, I didn't see any hidden elements in your HTML nor do I see any session action in your ASP)

    My point is, that if there is a new user, there should be no need to "disable" anything, they should just get a blank form. Existing users who are editing should get the same form populated with their current information.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #9
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I carried the existing member id (MemberNum) from the previous page: that is a reason why i have a piece of code below

    <%
    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
    %>

    Updating an existing information is working fine. it just like this:

    <%
    Case "Update" 'Value of the Submit Button

    dim MemberNode

    ErrorMessage = UserInput()

    If ErrorMessage = "" Then

    Set MemberNode = root.selectSingleNode("Member@MemberNum = '" & Request.Form("MemberNum") & "']")
    MemberNode.attributes.getNamedItem("MemberName").nodeValue = Request.Form("MemberName")
    MemberNode.attributes.getNamedItem("Gender").nodeValue = ConvertGenderBack(Request.Form("Gender"))
    MemberNode.attributes.getNamedItem("DateOfBirth").nodeValue = Request.Form("DateOfBirth")
    End If
    %>

    "
    My point is, that if there is a new user, there should be no need to "disable" anything, they should just get a blank form. Existing users who are editing should get the same form populated with their current information."

    Yes...I agree...that...I am using that logic......but still have any ??? for adding and how????

  • #10
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Better post this in the ASP forum.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #11
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I did, but it seems to me that no one knows.........

  • #12
    New to the CF scene
    Join Date
    Feb 2003
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Here's your answer

    I'm going off of your original Question. Assuming you want to clear the form if they want to add a new user?? If so here you go:

    <html>
    <head>
    <title>Untitled</title>
    <SCRIPT LANGUAGE="JavaScript">
    function clearForm()
    {
    SubmitForm.MemberName.value="";
    SubmitForm.Gender.value="0";
    SubmitForm.DateOfBirth.value="";
    }
    </script>
    </head>
    <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="0">Select Gender</option>
    <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</span></TD>

    </tr>
    </table>
    <table>
    <tr>
    <td>
    <INPUT type="submit" value="Add New Member" name="Submit" onClick="javascript:clearForm();return false">
    </td>
    </tr>
    </table>
    <table align="center">
    <tr>
    <td>
    <INPUT type="submit" value="Update" name="Submit">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    I just wrote a small function to set the form elements back to blank and then call that using the "onClick" event handler.

  • #13
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Here's your answer

    Originally posted by midntrdr
    I'm going off of your original Question. Assuming you want to clear the form if they want to add a new user?? If so here you go:
    That can't possibly be what's needed. If a new user is signing up, why would you want to remove ALL their information just prior to submitting it?

    And why on earth would you make a submit button act like a reset button? Just use a reset button!
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #14
    Regular Coder
    Join Date
    Nov 2002
    Posts
    184
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks midntrdr ....for giving me a try.

    Yes, you are so right .... beetle "That can't possibly be what's needed."

    I don't want to replace the existing member for a new member. I would like to have both.

  • #15
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I could do this easy in PHP, here's the logic I'd follow...pseudo code
    Code:
    if ( userIdPresent )
    {
        show user data with form;
        show "Update" submit button;
    }
    else
    {
        show empty form;
        show "Add" submit button;
    }
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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