Health 2007 - Debt Consolidation - Debt Consolidation - Loans - Valentine's Day Gifts

PDA

View Full Version : Newby help please - referencing ID parameter


pbaylis
Mar 12th 2008, 8:36 pm
I'm a cold fusion developer who knows nothing about javascript. So, I need some help here please.

I have set hidden form fields in my form template, as follows:

<form name="theform" action="actionpage"..etc>
<input type="hidden" id="xPhoto1" name="Photo1" value="#Photo1#">
<input type="hidden" id="xPhoto2" name="Photo2" value="#Photo2#">
<input type="hidden" id="xPhoto3" name="Photo3" value="#Photo3#">
<input type="hidden" id="xPhoto4" name="Photo4" value="#Photo4#">
<input type="submit"...etc>
</form>

The page that processes this form needs to check for the existence of the ID attribute in the above form. In words, it would work something like this:
If there is an id field with value of xPhoto1 in the passing form, then do something....else do something else.

I need to keep the name attribute as it is because it references a database field. I was hoping I could use the ID attribute to reference this particular hidden field without also referencing a form field name.

Thanks in advance for any assistance.

Kind regards,
Paul

roy.laurie
Mar 12th 2008, 9:19 pm
if (document.getElementById('xPhoto1') != null)
{
// do work here
}