Flying35 Posted November 28, 2011 Share Posted November 28, 2011 Hello phpfreaks, I try to make buttons witch can enable text field that are disabled. But it doesn't work when I'm working with variables. while (list($id,$naam,$voorraad,$bestelgrootte,$doelvoorraad,$prijs,$aantal,$wijzig) = mysql_fetch_row($res)) $inkvm .= "<tr><td>".$id. "</td><td>".$naam. "</td><td>".$voorraad. "</td><td>".$bestelgrootte. "</td><td>".$doelvoorraad. "</td><td>".$prijs. "</td><td> <form name='".$id."'> <input type='text' value='".$aantal."' name='".$id."' size='2' disabled='disabled'/> </form> </td><td> <input type='button' value='Aanpassen' OnClick='document.".$id.".".$id.".disabled=false;'/> </td></tr>"; Does someone know why this isn't working? already thanks. Quote Link to comment Share on other sites More sharing options...
joe92 Posted November 28, 2011 Share Posted November 28, 2011 You'll need to edit the onclick to something along these lines; onclick="document.getElementById('id').disabled = false;" .. Give an id to the textfield and replace the above id with the id of the text field Quote Link to comment Share on other sites More sharing options...
Flying35 Posted November 28, 2011 Author Share Posted November 28, 2011 thanks it works now, I used the wrong quotes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.