/    Sign up×
Community /Pin to ProfileBookmark

dynamically creating a new (invisible) form

Hi,

I’m writing a javascript for IE 6 (yes, I know it’s better to be protable, but we only need it for a limited number of IE 6 users).

I would greately appreciate advice as to whether there’s a way to dynamically create a new form which is *invisible* (in memory only), populate it, and then submit the new form.

Notes:
1) I have to use POST, this is why I can only rely on form.submit() . If it were GET, I could manually concatenate required parameters to the server URL, and put it into the navigator. But this won’t work for POST.

2) The form needs to be created dynamically, and be invisible. The idea is, I collect data from various crazy controls, do some javascript calculations, and then submit a shorter and clearer parameters list to the server.

In * non-formal * notation, it would be something like:

[code]
// This is not real javascript, just the general way i’d
// like it to appear!
// Invisible form in memory:
form f=new form();
f.method=’post’;
// Add parameter “salary=99” :
f.salary = new textInput(); f.salary.value=99;
// Add parameter “department=HR”:
f.department=new textInput(); f.department.value=’HR’;
// Submit:
f.submit();
[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayJan 24.2005 — Should be able to create your form in an "invisible" DIV, ie.

<div id="hiddenDiv" style="display:none">...
×

Success!

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