Forum Moderators: coopster

Message Too Old, No Replies

The "invisible" Checkbox

Checkbox does not appear

         

typomaniac

11:22 pm on May 11, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



First, I didn't post this in javascript because that is not what I'm having a problem with, though it is a piece of js in a php file.
Its a simple little add-in where if you check the box a password appears in plain text.
I tested it both in a plain html page and a php page. It works fine but when I put it in my script it fails. The code is (values have been changed).

<input type="password"name="pwd7"id="pwd7"autocomplete="off"size="20"maxlength="35"value="<?=$pwd7;?>">
<br>
<input type="checkbox"onChange=
"document.getElementById('pwd7').type=this.checked ? 'text' : 'password'">
Show password


When I run a php page containing this it does what it is supposed to do but in the middle of my script it doesn't show the checkbox. I even tried placing it in different areas of the page just to see what would happen but always the same.

What, in a script could cause the fail? There is much validation ahead of this area of the page and mysql inserts but everything is in good working order, that is until I decided to give this a shot. Also, if this should be posted under js I apologize.

not2easy

2:45 am on May 12, 2017 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



One thing that might cause an issue with having javascript loaded as part of the content of a php file is that php is server-side (processed before it loads) and javascript is client-side (loads with other objects on a page) so the javascript may be executing before the page loads.

lucy24

4:13 am on May 12, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



it doesn't show the checkbox

Doesn't show the box at all, or shows but it isn't checked?

typomaniac

4:31 am on May 12, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



No, it isn't showing the checkbox at all. I spent the day searching out answers and came across a bunch of scripts for the job, including some j query gigs. It must be something with the script I'm running because while all these things are working great when I test them on a blank page but come showtime...nothing going. Not giving up too easy though--really interested to know what gives here.

typomaniac

5:20 am on May 12, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



Problem fixed. I found a j-query script and it worked like I wish all the others had. Might never know what the problem was but I hope it don't go on to plaguing others. Thank all of you millions. Hopefully I can help somebody else some day.

tangor

6:22 am on May 12, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Happy you solved it ... but strongly suggest you find out WHY it worked. Part of being a coder/webmaster is knowing HOW your stuff works, even the stuff you borrow from another. If you DON'T know how it works, you won't have a clue on to fix it when something else breaks it.

typomaniac

5:30 pm on May 12, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



lol, I know---its called up that famous creek without a paddle. When I get things caught up a bit I'm going to look into that one 'cause the one I borrowed uses jquery and things like that where as the original was only 3 short lines of javascript. I duplicated the form part of the program and saved it as a .pl and .html files and the original script worked okay. Should have stuck with perl, but I'm doing this for someone else and it can be hard to find someone to work on a perl script if the original writer isn't readily handy and there are lots of people who work with php. Not that I wouldn't fix something but I always plan for worse case scenarios. Who knows, maybe it will run forever.

typomaniac

5:31 pm on May 12, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



btw.....thanx for all the responses in such a quick time. This IS the place ! :)