Jump to content

Recommended Posts

OK, I have hit a snag and I want to try and make this work if I can. I am trying to add a new text field next to a current list field based on a single selected item. can anyone help me on this? I added the segments that I want this to change. *script* function DbRole(myform){if (document.myform.Accesslevel1.value=="Database Role = "){document.myform.Accesslevel1("DbRole1").setValue(""); AddFields();}} *form* <input name="Accessgroups1" type="text" size="50"> <select name="Accesslevel1"> <option value=""></option> <option value="Read">Read</option> <option value="Write">Write</option> <option value="Read/Write">Read/Write</option> <option value="Update">Update (accounting)</option> <option value="Delete">Delete (Accounting)</option> <option value="Update/Delete (Accounting)">Update/Delete (Accounting)</option> <option onChange="DbRole()" value="Database Role = ">-Database Role-</option> (**the idea is that when this last item is selected a text field will appear next to this list field**) </select> Any help would be appreciated, I am new to this but I have already managed to set up other js that works but this one escapes me at this moment.

Link to post
Share on other sites

OK so I put the onchange in my select but I am not sure how I check the value of the selected option. <select name="Accesslevel1" onChange="DbRole(Accesslevel1.value);"> the if condition should only be when "Database Role" is selected. I also am not sure if I did the "addfeilds()" part right.

Link to post
Share on other sites

No. There's no variable called "Accesslevel1"You have to pass a reference to the element in the function.

<select name="Accesslevel1" onChange="DbRole(this);">

function DbRole(el) {    var value = el.options[el.selectedIndex].value;    if(value == "Database Role = ") {	    // There is no document.myform, this is non-standard and shouldn't be used	    // Use getElementById() or getElementsByTagName()	       }}

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...