Someone experience with List Box & form please hel

Results 1 to 2 of 2

Thread: Someone experience with List Box & form please hel

  1. #1
    Join Date
    Dec 1969

    Default Someone experience with List Box & form please hel

    1. Please refer to<BR>I need to pass the information on a page call insert2.asp. I need to make sure the new inserted item doesn&#039;t exist in our database so I created the above link, as you can see, if user click on the checkbox, list box will disabled and only enable the txtNewItemName, same for Model. I have Mr. Bill Wilkinson trying to assist me & Lynn (my co-worker), but still it doesn&#039;t work dynamically. I came up with the idea below, can someone help to translate my dream command into ASP? I have to thank you in advance.<BR><BR>If "New Item" checkbox checked then<BR><BR> select return_value from dual;<BR><BR> assign return_value to varPK;<BR><BR> insert into adminuser.av_item (item_id, item_name) values (varPK, txtNewItem);<BR><BR>else<BR><BR> Either acquire item_id from the item list box, and assign to varPK, or create recordset like so:<BR><BR> select item_id from adminuser.av_item where item_name = listbox.item; (value from listbox);<BR><BR> assign item_id from above recordset to varPK;<BR><BR> if "New Model" checkbox checked then<BR><BR> insert into adminuser.av_inventory (item_id, model, serial, ouid)<BR> values (varPK, txtModel, txtSerial, txtOUID); (value from New Model text box)<BR><BR> else<BR><BR> insert into adminuser.av_inventory (item_id, model, serial, ouid)<BR> values (varPK, listbox.model, txtSerial, txtOUID); (value from Model list box)<BR><BR> end if<BR><BR>end if

  2. #2
    Join Date
    Dec 1969

    Default How about somebody that can debug?

    That page DOES NOT WORK.<BR><BR>It gets a JavaScript error when it first comes up!<BR><BR>And the reason is dead obvious: Your JS code is making a reference to document.theForm, but the name of your form is "theform". <BR><BR>JS is CASE SENSITIVE. theForm is *NOT* the same as theform.<BR><BR>Anyway, the code you want build is not advanced, at all. Heck, if you&#039;d just translate that description above into VBScript, you&#039;d be 90% done.<BR><BR>&#060;%<BR>If Request.Form("NewItem") &#060;&#062; "" Then<BR>&nbsp; &nbsp; Set RS = Conn.Execute("select return_value from dual")<BR>&nbsp; &nbsp; varPK = RS("return_value")<BR>&nbsp; &nbsp; SQL = "insert into adminuser.av_item (item_id, item_name) values (" & varPK & ",&#039;" & txtNewItem & "&#039;);"<BR>&nbsp; &nbsp; conn.Execute(SQL)<BR>else<BR><BR>etc., etc., etc.<BR><BR>But you guys could have made this thing a WHOLE lot easier if you had created you &#060;SELECT&#062; lists just a tiny bit smarter.<BR><BR>You have options in your select that look like:<BR>&nbsp; &nbsp; &#060;option value="17MM Projector" &#062;17MM Projector&#060;/option&#062;<BR><BR>Pardon me, but that&#039;s silly. It would make *MUCH* more sense to have, instead,<BR>&nbsp; &nbsp; &#060;option value="371P" &#062;17MM Projector&#060;/option&#062;<BR><BR>That is, put the item_id of the selection as the Value= instead of just duplicating the item name.<BR><BR>You guys have asked a *TON* of questions on this project, and you still seem to be struggling with basic concepts. Have you got *ANY* decent reference book you are working with? Such as the WROX books or the book from SAMS Publishing that Scott Mitchell (our site host) wrote?<BR><BR>I&#039;m sympathetic to the idea of students working on projects to help the school and, presumably, to learn their craft at the same time. But it&#039;s hard for me to believe that somebody has turned you loose on this with no guidance and no reference materials. <BR><BR>In the long run, you&#039;d get this project done a lot faster if you&#039;d stop and *PLAN* what you need to do, rather than just rushing into the next ASP page and taking a dozen or more tries to get it right. If you were working in the "real world", and if your boss had a brain in her/his head, that&#039;s what you&#039;d do. You&#039;d have to develop a plan and have it approved. Only then would you actually start coding.<BR><BR>I&#039;m more than willing to help you find your errors. But when you ask questions about very basic programming techniques...well, how much help can we possibly give you here in this forum? Write the entire site for you? I&#039;m afraid not.<BR><BR><BR><BR>

Posting Permissions

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