I am trying to get a form to post an alert if fildname = something. I am not sure how to go about this.
Should I use java or php???
Where do I put the code???
Thanks for the help.
:mrgreen:
Should I use java or php???
Where do I put the code???
var r={fildname};
if (r==this)
{
alert( “message”);
}
else
{
document.write ( “Have a good day!”); }
}
Thanks for the help.
:mrgreen:
Hi mabeach,
You need to use JavaScript (neither Java nor PHP).
If your input has id='fildname' then you can use code something like this in a Load JS action:
Bob
You need to use JavaScript (neither Java nor PHP).
If your input has id='fildname' then you can use code something like this in a Load JS action:
window.addEvent('domready', function() {
var fildname = $('fildname');
fildname.addEvent('change', function() {
if ( fildname.value == 'xxxx' ) {
alert('message');
}
});
});
You may need to find someone to help with the exact JavaScript that you need. Bob
Thanks for the reply.
I am still not have any luck.
I did some testing and I am not getting the fild name. I added the code to the JS load and put that in the submit button, so this will show up before the user gets to the thank you message.
Here is the test I did:
I do get the alert but the text is null.
Any idea?
I am still not have any luck.
I did some testing and I am not getting the fild name. I added the code to the JS load and put that in the submit button, so this will show up before the user gets to the thank you message.
Here is the test I did:
var x == $(fildname);
alert(x);
I do get the alert but the text is null.
Any idea?
Hi mabeach,
I don't understand what this line is supposed to be??
You may need to find someone to help with the exact JavaScript that you need.
Bob
I don't understand what this line is supposed to be??
var x == $(fildname);
It looks as though you are making up code here.You may need to find someone to help with the exact JavaScript that you need.
Bob
I am a bit new to javascript. Sorry.
I want to
set var to x
make x = fildname
alert(x);
but still not work.
Can you tell my how to grab the fildname from a form in a var after I hit submit?
I want to
set var to x
make x = fildname
alert(x);
alert("TEST: " + document.forms["FORMNAME"]["fildname"].value);
but still not work.
Can you tell my how to grab the fildname from a form in a var after I hit submit?
mabeach,
Please compare you line of code:
with the line from Bob's example code:
and then make the necessary 3 changes.
PolderGuy
Please compare you line of code:
var x == $(fildname);
with the line from Bob's example code:
var fildname = $('fildname');
and then make the necessary 3 changes.
PolderGuy
I did some more testing and I am unable to get the var. Here is the test I ran.
This is the code I want to work.
//I don't think this is getting the VAR right
var fildname = $('input_radio_18');
if (fildname == x)
{
//This is = NULL
alert(fildname);
}
This is the code I want to work.
//This is the code I want to work.
var fildname = $('input_radio_18');
if (fildname == 'some test')
{
alert("You have picked a Tour. Please contact the team to discuss details.");
}
mabeach,
Please compare your line of code:
with Bob's:
and again make 3 changes.
You're getting closer ...
PolderGuy
Please compare your line of code:
if (fildname == x) {
with Bob's:
if ( fildname.value == 'xxxx' ) {
and again make 3 changes.
You're getting closer ...
PolderGuy
Did some more testing with this code below--with no luck. I know this code is not getting the var right...so what am I missing?
var fildname = $('input_radio_18');
if (fildname.value == 'text')
{
alert("You have picked a Tour. Please contact the team to discuss details.");
}
Hi mabeach ,
That code looks like good JavaScript.
Use your preferred web developer tools (F12 in IE8 or IE9, Shift+Ctrl+I in Chrome, FireBug in FireFox, DragonFly in Opera) to check what the value of fildname.value is. That will help you to know what needs to be fixed next.
Bob
That code looks like good JavaScript.
Use your preferred web developer tools (F12 in IE8 or IE9, Shift+Ctrl+I in Chrome, FireBug in FireFox, DragonFly in Opera) to check what the value of fildname.value is. That will help you to know what needs to be fixed next.
Bob
I am running chrome. I looked with the console on the form page and
fildname.value = undefined
Also on the result page fildname = null.
fildname.value = undefined
Also on the result page fildname = null.
Hi mabeach,
It will be undefined until the snippet runs. What is the value of $('input_radio_18')?
Bob
It will be undefined until the snippet runs. What is the value of $('input_radio_18')?
Bob
That is the name of the fild id of the Radio Box.
The console gave me this. I think I am doing it wrong.
But if i do this.
it = input_radio_18
How should I test this?
The console gave me this. I think I am doing it wrong.
document.write $('input_radio_18');
SyntaxError: Unexpected identifier
But if i do this.
document.write ('input_radio_18');
it = input_radio_18
How should I test this?
This topic is locked and no more replies can be posted.