/    Sign up×
Community /Pin to ProfileBookmark

Textbox update checker not working

I have a JS that checks if my selects, text and textboxes were changed on a form and lets the form process if any changes were made. If no changes were made then it pops up an alert message. It works in IE and but wont work in NS7 when a textbox has alot of info in it.

Please advise of a better way to do this or how I can get it to work in NS7:

[code]
<script>
function checkF_status(myFrm) {
var el, opt, i = 0, j;
while (el = myFrm.elements[i++]) {
switch (el.type) {
case ‘text’ :
case ‘textarea’ :
if (el.value != el.defaultValue) return F_isChanged(myFrm);
break;
case ‘radio’ :
case ‘checkbox’ :
if ((el.checked && !el.defaultChecked) || (!el.checked && el.defaultChecked)) return F_isChanged(myFrm);
break;
case ‘select-one’ :
case ‘select-multiple’ :
j = 0;
while (opt = el.options[j++]) if ((opt.selected && !opt.defaultSelected) || (!opt.selected && opt.defaultSelected))
return F_isChanged(myFrm);
break;
}
}
alert(“NO CHANGES MADE SO NOT PROCESSING”);
return false;
}

function F_isChanged(myFrm) {
return true;
}
</script>

<form name=”myFrm” action=”actionpage.cfm” method=”post” onsubmit=”return checkF_status(this);”>
<textarea rows=”3″ cols=”40″ name=”ye” wrap=”hard”>IN NS 7, IF I HAVE ALOT OF INFO HERE IT WONT WORK, BUT WORKS IN IE ALL THE TIME</textarea><br /><br />
<input type=”text” value=”blah”><br /><br />
<input type=”radio” name=”r1″ checked=”checked”> foo<br />
<input type=”radio” name=”r1″> bar<br />
<input type=”checkbox” name=”c1″ checked=”checked”> hoo
<input type=”checkbox” name=”c1″> hah<br /><br />
<input type=”checkbox” name=”c2″>eek<br /><br />
<SELECT NAME=”fieldname”>
<OPTION VALUE=”a” SELECTED>a</OPTION>
<OPTION VALUE=”b”>b</OPTION>
<OPTION VALUE=”c”>c</OPTION>
</SELECT>
<input type=”submit”>
</form>
[/code]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @florida spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...