Ninjakreborn Posted April 28, 2006 Share Posted April 28, 2006 How do I access strictly to a form field. I am trying to do something with javascript and php, I have a function created in javascript, that I am trying to secure, then I am going to use it with php to validate, what do I do to access a form field. Right now I have a function with onsubmit() and I called it, but I am not accessing the form fields right I tried multiple ways, because I also need to use this to create some classes in php, I triedfor instance my firstname fieldI tried test form is the name of my form by they waydocument.testform.firstnameI trieddocument.testform.['firstname']document.testform.["firstname"]I even triedwindow.document.testform.firstnamewindow.document.testform.['firstname']and window.document.testform.["firstname"]nothing here gives me access to that form field. How do I correctly gain access to this, Link to comment https://forums.phpfreaks.com/topic/8600-dom/ Share on other sites More sharing options...
Ninjakreborn Posted April 28, 2006 Author Share Posted April 28, 2006 can anyone help with this, it's the only thing holding me back< I am still trying to figure out something but everything I try is not working, I can't get the function to access the form field no matter what I put in, I know my own submit works, I have tested that, it has something to do with me accessing the fields, my function structure is good, I triple checked it to make sure I set up everything the only thing I can think of is I am not accessing the form field right. Link to comment https://forums.phpfreaks.com/topic/8600-dom/#findComment-31543 Share on other sites More sharing options...
Ninjakreborn Posted April 28, 2006 Author Share Posted April 28, 2006 bump Link to comment https://forums.phpfreaks.com/topic/8600-dom/#findComment-31552 Share on other sites More sharing options...
.josh Posted April 28, 2006 Share Posted April 28, 2006 okay dude seriously, this is like how many times I and other people have told you that you are asking javascript questions in a php forum. please go to javascript forum to get javascript questions answered. I would be more than happy to help you if i knew javascript. but i don't. that's why i'm here. and so is everybody else. but nonetheless, i googled "javascript get form value" (google is your friend too) and i think what you are looking for is something along this line:variablename=nameofform.nameoffield.value;example:<form name="blah" method="post">enter fruit<input name="fruit"></form>and then <script = 'javascript'> fruitchoice = blah.fruit.value;document.write(fruitchoice);</script> Link to comment https://forums.phpfreaks.com/topic/8600-dom/#findComment-31558 Share on other sites More sharing options...
Ninjakreborn Posted April 28, 2006 Author Share Posted April 28, 2006 thanks Link to comment https://forums.phpfreaks.com/topic/8600-dom/#findComment-31649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.