/    Sign up×
Community /Pin to ProfileBookmark

javaScript function

Hi all.

I am trying to find what is wrong with this javascript function.
Is somebody can help me? (Where is Pit??)

function OnAddUser()
{
var form = document.forms[0];
var cmd = ”;

var index = form.selectUser.selectedIndex;

if (!def(form.textUser) || !def(form.passwordUser) ||
!def(form.radioPriv[0]))
{
if (index > 0)
{
cmd += ‘no username’ + userArray[index-1].name + ‘[configure]’;
}
cmd += ‘username $textUser’;
if (form.radioPriv[1].checked)
cmd += ‘ privilege 15’;
else
cmd += ‘ privilege 1’;
if (isBlank(form.passwordUser.value))
{
cmd += ‘ nopassword’;
}
else
{
cmd += ‘ password 0 ‘;

cmd += form.passwordUser.value;
}

cmd +='[configure]’;

}

if (!isBlank(cmd))
{
cmd += ‘write memory quiet’;
clearHidden();
form.htmlSubmit.value = ‘true’;
locationCookie.location = ‘LocalUserList’;
locationCookie.store();
form.action = encode(cmd)’
form.submit();
}
}

why the statement “form.submit();” is not working?
what is the purpose of the ‘def’ function?

Thank you all

David

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@fredmvJan 24.2005 — [i]Originally posted by bezaleli [/i]

[B]why the statement "form.submit();" is not working?[/B][/QUOTE]
There are a myriad of reasons why it is not. We need to see the accompanying markup to properly find the source of the problem. HTMLFormElements, absolutely have a [font=courier]submit[/font] method, though. So that line is valid. It is probably something to do with how you implemented it.[i]Originally posted by bezaleli [/i]

[B]what is the purpose of the 'def' function?[/B][/QUOTE]
Seeing as there is no function of such name, one could only guess. But, given the usage, it probably does a [font=courier]typeof[/font] check on the argument in which you pass it to see if the object exists or not.
Copy linkTweet thisAlerts:
@bezaleliauthorJan 25.2005 — Thank you for your help.

i am trying to manage an AccessPoint and configure it by loading its web pages onto an Internet Explorer component i wrote.

This function is not responding to my call.

Thanks again

David
×

Success!

Help @bezaleli 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.16,
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,
)...