/    Sign up×
Community /Pin to ProfileBookmark

problem accessing a textbox using document

Hello .. this is my problem …

I am calling this function(updateRecord) on an onclick in a link … everytime I try to access the current value in the textbox it gives me an error of “undefined” but I swear its correct, so maybe I am missing something. Or I just may not be able to do this. The way the textbox gets named is in a while loop in ASP (example below the JAVASCRIPT) Thank you to whoever helps me with this. If anyone has an easier way to do this maybe? I have tried so many tutorials.

/////////////////////////

[CODE]function updateRecord(task_id, wf_id, month, year, hoursTXT)
{

alert(“task id= “+task_id+ “| wf_ID= “+wf_id+ “| month= “+month+”| year= “+year+”| hoursTxt =”+hoursTXT);

var hoursval;
var temp;

var the_element_string = “document.myform.”+hoursTXT;
hoursval = eval(the_element_string);
temp = eval(the_element_string.text)
alert(“task id= “+hoursval+” | string= “+the_element_string+”| temp= “+temp);
//window.open(‘updaterecord.asp?task_id=’+task_id+’&WF_ID=’+wf_id+’&Month=’+month+’&Year=’+year+’&hours=’+hoursval); } [/CODE]

////////////

[CODE]<input type=”Text” name=”Txt<%=rs(11)%>” size=3 value=”<%= FormatNumber(rs(7), 2) %>”>[/CODE]

this is the link code …

[CODE]<a href=’javascript:updateRecord(<%= rs(11)%>, <%=Request.QueryString(“WF_ID”)%>,<%=Request.QueryString(“Month”)%>,<%=Request.QueryString(“Year”)%>, “Txt<%=rs(11)%>” )’>Update</a>[/CODE]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@UltimaterApr 13.2005 — <i>
</i>temp = eval(the_element_string[color=red].text[/color])

I think that you meant:
<i>
</i>temp = eval(the_element_string).text


Also it seems that the end of your function, the curley bracket, is being commented out.
×

Success!

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