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
    Rey
    Rey is offline
    New Coder
    Join Date
    Sep 2006
    Location
    Peoria, AZ
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Request.Form collection empty on post

    Howdy all.
    Finding that the request.form collection when checked on the called form is empty.

    No idea as to err as no msg is displayed.

    The base form is table listing the uploaded glaucoma screenings. In the table, I've added a column displaying an html input button that contains the record ID for that patient.

    Various code pieces explained below.

    Appreciate your comments/suggestions as I'm going bald and getting frustrated. Moving onto something else such as setting up 2 pc's...

    Thanks,

    Rey


    This is the form code and a hidden field into which I place the value of the button clicked. This is I can use this value (recID) in subsequent SQL statements to retrieve the data stored in several MySQL tables associated with the patient record.
    Code:
    <form method="post" EncType="Multipart/Form-Data" action="http://localhost/secureeyespec/esgl001e.asp" 
    		id="frmSelectScreen" name="frmSelectScreen" onsubmit="return form_validator();">
      <input type="hidden" id="btn_clicked" name="btn_clicked" value="">
    This is the button code being used.
    Code:
    <td width="50" align="center">
       <input style="width: 4em;" type="submit" id="<%= btnName %>" 
       name="<%= btnName %>" size="150px" onclick="screenselected(this);"
        maxlength="150" value="<%= recID %>">
    </td>
    This is the JavaScript code used to validate. Once I got my head out of my fifth point of contact...using type=button instead of type=submit, I was then able to get to the called page where before the button only displayed the value of the clicked button.

    Even added an HTML text field that is not visible via CSS instead of hidden field as a test - nothing was send over.

    Code:
    	function form_validator()
    	{
    		// purpose: check to see if hidden field value contains
    		//          value of btn clicked
    		var hidField = document.getElementById('btn_clicked');
    		
    		alert("Value of btn_clicked = " + hidField.value);
    		
    		if (hidField.value != "")
    		{
    			alert("Value of btn_clicked NOT equal to empty string = " + hidField.value);
    			return true;
    		}
    		else
    		{
    			alert("Value of btn_clicked IS equal to empty string = " + hidField.value);
    			return false;
    		}
    	}
    	
    	function screenselected(elem)
    	{
    		// purpose: pass to hidden field the patientID value
    		//          obtained from the button value
    debugger;		
    		var btnName = elem;
    		alert("btnName = " + btnName.name);
    		
    		var theID = btnName.value;
    		alert("btnName value = " + theID);
    		
    		// set hidden field value
    		var theField = document.getElementById('btn_clicked');
    debugger;		
    		theField.value = theID;
    		
    		alert("Hidden field (btn_clicked) value = " + theField.value);
    		
    		// now setting the non visible text field
    		var nodisplay = document.getElementById('noDisplay');
    		nodisplay.value = theID;
    		alert("Text field (noDisplay) value = " + nodisplay.value);
    		return true;
    	}

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,965
    Thanks
    79
    Thanked 4,429 Times in 4,394 Posts
    The culprit is the EncType you are using in the <form> tag.

    You should only use that encoding type when you are uploading a file (using <input type="file">) and using a component that understands that encoding.

    Just remove the EncTyp completely and it will work.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    Rey (05-01-2013)

  • #3
    Rey
    Rey is offline
    New Coder
    Join Date
    Sep 2006
    Location
    Peoria, AZ
    Posts
    16
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Howdy.
    Thanks for the info.
    Just reviewing old post for request.form and one from Spudhead informed the poster to remove the enctype="text/plain".

    That got me to googling and found that was just like you mentioned associated with an upload control.

    Changed my test form and shazam! it worked.
    Moving forward one step at a time...

    Thanks again,

    Rey


  •  

    Posting Permissions

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