/    Sign up×
Community /Pin to ProfileBookmark

Form Field Visibility

I’m not positive that I am posting this in the right place, so I apologize if this is wrong.

I’m developing a web application using ColdFusion. This application has a form with several dependent drop down menus. I am using Ajax to populate the dependent menus (based on what is selected in the menu above).

Now for the problem: When the menus are being populated by Ajax, there is a bit of a delay, and sometimes it can kind of bug out if you click to soon, and you will still see the same drop down choices that were in the menu before. Basically what I would like to do is have each drop down menu become invisible until it has been completely (re)populated.

I tried messing around in the javascript like this:
document.descriptionForm.wo_module.visibility = ‘hidden’;

this had no effect on the form though, and the menu (wo_module) stayed visible the whole time. I appreciate any help! Thanks.

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@MedranauthorMay 30.2007 — Ah, posted in the wrong place. Sorry bout that. Quick bump to make sure the right people see this now. Thanks!
Copy linkTweet thisAlerts:
@MedranauthorMay 30.2007 — form in question:
[CODE]<td>
<span style="font-size:12px"><span style="color:#FF0000">*</span>Area:</span>
</td>

<td>
<cfselect name="wo_area" id="wo_area" style="font-size:12px;" query="rsTeamsNS" value="team" display="team" queryPosition="below" width="300" onChange="getModule()">
<option>Please select</option>
</cfselect>
</td>
</tr>

<tr>

<td>
<span style="font-size:12px"><span style="color:#FF0000">*</span>Module:</span>
</td>

<td>
<cfselect name="wo_module" id="wo_module" style="font-size:12px;" query="rsDept" value="dept_name" display="dept_name" queryPosition="below" width="300" onChange="getMachine()">
<option>Please select</option>
</cfselect>
</td>[/CODE]


here is the javascript i have currently:
[CODE]
function getModule(){
//this visibility statement does not work
document.descriptionForm.wo_module.visible = 'false';

var team = DWRUtil.getValue("wo_area");
DWREngine._execute(_cfscriptLocation, null, 'moduleUpd', team, getModuleResult);
}

function getModuleResult(moduleArray){

DWRUtil.removeAllOptions("wo_module");
DWRUtil.addOptions("wo_module", moduleArray);

//this visibility statement also does not work
document.descriptionForm.wo_module.visible = 'true';

}
[/CODE]


getModule() just references a seperate coldfusion page and returns an array of items to populate the "wo_module" list. I just want the "wo_module" field to be invisible to the user from the time that getModule() is called to the time that getModuleResult() finishes.
Copy linkTweet thisAlerts:
@MedranauthorMay 30.2007 — alright, i got it working. here is the fixed javascript:

[CODE]
function getModule(){

document.descriptionForm.wo_module.style.display = "none";

var team = DWRUtil.getValue("wo_area");
DWREngine._execute(_cfscriptLocation, null, 'moduleUpd', team, getModuleResult);
}

function getModuleResult(moduleArray){
DWRUtil.removeAllOptions("wo_module");
DWRUtil.addOptions("wo_module", moduleArray);

document.descriptionForm.wo_module.style.display = "inline";

}[/CODE]
×

Success!

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