asp.net mvc - Javascript prompt alert and submit form with value -



asp.net mvc - Javascript prompt alert and submit form with value -

i want submit form using javascript when clicking on image. clicking actual submit button works, not javascript submit.

<img class='file' src="imagehere" onclick="editfilename()"/> <script> function editfilename() { var filename = prompt("type in name:"); if (filename != null) { document.getelementbyid('editnamefield').value = filename; //tried these 2 document.editfilename.submit(); document.getelementbyid('test').submit(); } } </script> @using (html.beginform("edituploadedfilename", "folder", new { name = "editfilename", id = "test" })) { <input type="hidden" id="editnamefield" value="a"> <input type="hidden" id="blobname" value="a"> <input type="submit"/> }

edit

corrected button typo. has nil not working, typo when inserted code. reason downvoting? geez

<input type="submit"/> alter button input , should work.

javascript asp.net-mvc

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -