JavaScript and client side scripting.
Moderator: General Moderators
qads
DevNet Resident
Posts: 1199 Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane
Post
by qads » Wed Sep 24, 2003 3:25 pm
elo
got a weird problem, i have 2 text fields that i don't want the user to use, i tried useing:
Code: Select all
<input name="coupon_valid_from" type="text" size="10" disabled>
if i use this method, then its not set in php, so i can't see what was in it (i use another script to put value in it).
is there anything else i can use for this? something that will stop the user from typeing in this field, but it should be set in php...
thanks alot
Leviathan
Forum Commoner
Posts: 36 Joined: Tue Sep 23, 2003 7:00 pm
Location: Waterloo, ON (Currently in Vancouver, BC)
Post
by Leviathan » Wed Sep 24, 2003 3:40 pm
So basically you want hidden fields so you can pass a value to the server without the user knowing? I can't remember the exact syntax, but you either use
Code: Select all
<input type="hidden"...> or <input type="text" hidden...>. I think it's the first choice.
qads
DevNet Resident
Posts: 1199 Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane
Post
by qads » Wed Sep 24, 2003 3:52 pm
well, not exectly, i still need to show what is in the text box, i am playing around with hidden fields now, hopefully i will get it working...if so, i will post it...
any idea on how to call a function 2 times "onclick"?
Code: Select all
<a href="#" onClick="getCalendarFor(document.coupon.coupon_valid_from);getCalendarFor(document.coupon.coupon_valid_from_show);return false;">Choose Date</a>
this is not working
thanks
microthick
Forum Regular
Posts: 543 Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC
Post
by microthick » Wed Sep 24, 2003 4:23 pm
For normal INPUT fields you can use the JavaScript blur() function, if that helps.
Code: Select all
<input type="text" size="40" onClick="blur();">
This will disallow the user to edit any text in the input box.
Leviathan
Forum Commoner
Posts: 36 Joined: Tue Sep 23, 2003 7:00 pm
Location: Waterloo, ON (Currently in Vancouver, BC)
Post
by Leviathan » Wed Sep 24, 2003 4:32 pm
To call a function twice, you could make a second function that does the two calls for you, and call that new function.
Code: Select all
a {
b(1);
b(2);
}
<input type="text" name="somefield" onclick="a();">
qads
DevNet Resident
Posts: 1199 Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane
Post
by qads » Wed Sep 24, 2003 6:25 pm
cool, readonly works nicely
thanks guys
Vincent Puglia
Forum Commoner
Posts: 67 Joined: Thu Sep 04, 2003 4:20 pm
Location: where the World once stood
Post
by Vincent Puglia » Thu Sep 25, 2003 8:48 am
Hi
<input type="text" size="40" onFocus="this.blur();alert('Read Only')">
The alert isn't necessary, but it does give the user an idea of what is going on.
Re the 2fer:
send X number of arguments:
<a href="#" onClick="getCalendarFor(document.coupon.coupon_valid_from, document.coupon.coupon_valid_from_show);return false;">Choose Date</a>
and in the function, loop:
getCalendarFor()
{
var loopCnt = arguments.length;
for (var i = 0 ; i < loopCnt; i++)
{
someVar = arguments; // the nth argument being passed
....the function's code...
}
Vinny