/    Sign up×
Community /Pin to ProfileBookmark

setattribute "name"

Hi All,

i have an email form where users can add multiple textfields. All works file, but when they submit the email form, the values of those fields isn’t send.

this is a short version of the script:

[CODE]var inputs = 1;
function add_damage(){
var inp1 = document.createElement(‘INPUT’);
inp1.setAttribute(“Name”, “currency”+inputs);
inputs++
}
[/CODE]

when the form is submitted, i use a php-file as action;
short version of script;

[CODE]
<php?

$message=”

Naam: “.$name.” n
Email: “.$email.” n
Datum Rapport: “.$datereport.” nn

Beschadigde elementen
“.$currency1.” n
“.$currency2.” n
“.$currency3.” n

mail(“[email protected]”,”Form Submitted our website”,$message,$headers)
?>
[/CODE]

I just dont understand why the fields of [I]currency [/I]are empty. All other values from normal text fields get send (name, email, …).

Someone any ideas?

Thanx!
Yannick

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@PadonakApr 28.2007 — function add_damage(){

var inp1 = document.createElement('INPUT');

inp1.setAttribute("[color=red][b]name[/b][/color]", "currency"+inputs);

inputs++;

[color=red][b]document.getElementById("somewhere inside your form").appendChild(inp1)[/b][/color];

}
Copy linkTweet thisAlerts:
@felgallApr 29.2007 — Internet Explorer doesn't allow you to add a name after you create the field, you must create the element with the name already attached using a proprietary version of the createElement.

<i>
</i>function add_damage() {
/*@cc_on
@if (@_jscript)
var inp1 = document.createElement('&lt;input name="currency'+inputs+'"&gt;');
@else */
var inp1 = document.createElement("input");
inp1.name = "currency"+inputs;
/* @end @*/
inputs++;
document.getElementById("somewhere inside your form").appendChild(inp1);
}
Copy linkTweet thisAlerts:
@zazkarauthorApr 29.2007 — falgall and padonak,

thanx for the reply's!

i changed the "Name" to "[I]name[/I]" and inserted the "[I]document.getElementById("somewhere inside your form").appendChild(inp1)[/I];"

and the form works now properly under firefox and Iexplorer 7.0, havent tested it yet under 6.0 and safari

Thanx

greetz
×

Success!

Help @zazkar 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 6.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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...