By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,610 Members | 2,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,610 IT Pros & Developers. It's quick & easy.

Help needed!

P: n/a
Hello,

I have form that uses javascript createElement to add additional input
fields to it. However, my validating script will not process new input
fields because it can only find the named input boxes already on the page.
Anyone has any thoughts on how to solve this, your advice is much
appreciated.

Thanks
Feb 17 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a

Stone Chen wrote:
Hello,

I have form that uses javascript createElement to add additional input
fields to it. However, my validating script will not process new input
fields because it can only find the named input boxes already on the page.
Anyone has any thoughts on how to solve this, your advice is much
appreciated.

Thanks


Drive your validation from a Array of data. As you add fields push into
this array the new fields.

Your validation engine should loop through all the array records to do
validations.

Suggested Fields in table:
Name - Field Name
Alias - Alias of field (for display purposes if name is abstract)
ControlType - What type of control you are validating
ValidationType - NoNull or Value or NullWarning
DataType - Type of data in field (for value validation)

Each field type can have more than one record: eg, Null and Value
validation (checks for null / blank and if not null / blank, verify the
content)

Good luck!

JsD

Feb 17 '06 #2

P: n/a
"Java script Dude" <de********@yahoo.ca> wrote in
news:11**********************@g14g2000cwa.googlegr oups.com:

Stone Chen wrote:
Hello,

I have form that uses javascript createElement to add additional
input fields to it. However, my validating script will not process
new input fields because it can only find the named input boxes
already on the page. Anyone has any thoughts on how to solve this,
your advice is much appreciated.

Thanks


Drive your validation from a Array of data. As you add fields push
into this array the new fields.

Your validation engine should loop through all the array records to do
validations.

Suggested Fields in table:
Name - Field Name
Alias - Alias of field (for display purposes if name is abstract)
ControlType - What type of control you are validating
ValidationType - NoNull or Value or NullWarning
DataType - Type of data in field (for value validation)

Each field type can have more than one record: eg, Null and Value
validation (checks for null / blank and if not null / blank, verify
the content)

Good luck!

JsD


Thanks. I'm using a onBlur() event to push the field name, which is
generated dynamically, directly into the validation script, but the
validation script still cannot find the field. Any thoughts?
Feb 20 '06 #3

P: n/a
Lee <RE**************@cox.net> wrote in
news:dt*********@drn.newsguy.com:
Stone Chen said:

"Java script Dude" <de********@yahoo.ca> wrote in
news:11**********************@g14g2000cwa.google groups.com:

Stone Chen wrote:
Hello,

I have form that uses javascript createElement to add additional
input fields to it. However, my validating script will not process
new input fields because it can only find the named input boxes
already on the page. Anyone has any thoughts on how to solve this,
your advice is much appreciated.

Thanks

Drive your validation from a Array of data. As you add fields push
into this array the new fields.

Your validation engine should loop through all the array records to
do validations.

Suggested Fields in table:
Name - Field Name
Alias - Alias of field (for display purposes if name is abstract)
ControlType - What type of control you are validating
ValidationType - NoNull or Value or NullWarning
DataType - Type of data in field (for value validation)

Each field type can have more than one record: eg, Null and Value
validation (checks for null / blank and if not null / blank, verify
the content)

Good luck!

JsD


Thanks. I'm using a onBlur() event to push the field name, which is
generated dynamically, directly into the validation script, but the
validation script still cannot find the field. Any thoughts?


If you're using onBlur, why are you using the field name? You should
be passing a direct reference to the field (eg,
onchange="validate(this)". Note that I used onchange rather than
onblur(), because onblur() is almost always a mistake.

You should also choose a subject line that doesn't make you appear
to be a complete idiot.


Already changed to onChange(this), but there's some other problems with
that too.

BTW, why are people online so testy. I didn't filled in the subject line
because I couldn't think of a way to shorten my question in a meaningful
way. That gets me being called a "complete idiot". Jeez, @$$hole.
Feb 23 '06 #4

P: 1
Hello,

I am having the same problem with dynamically created form elements.
I read somewhere that IE has a bug that does not add dynamically created fields as named properties in the form. Therefore, even though you may be able to see the field by doing a form.elements[i].value, it will not let you access the form element using document.form.field.value. Basically you need to loop through the form elements and find the match.

var items = formname.elements;

for (i =0; i < items.length; i++){
if (items[i].name == 'enteryourfieldnamehere') {
//do your processing here
}
}

I'm trying to find a way around this. If you find one let me know.

Lee <REM0VElbspamtrap@cox.net> wrote in
news:dtbden01bbn@drn.newsguy.com:
[color=blue]
> Stone Chen said:[color=green]
>>
>>"Java script Dude" <despam2004@yahoo.ca> wrote in
>>news:1140152365.632557.115660@g14g2000cwa.google groups.com:
>>[color=darkred]
>>>
>>> Stone Chen wrote:
>>>> Hello,
>>>>
>>>> I have form that uses javascript createElement to add additional
>>>> input fields to it. However, my validating script will not process
>>>> new input fields because it can only find the named input boxes
>>>> already on the page. Anyone has any thoughts on how to solve this,
>>>> your advice is much appreciated.
>>>>
>>>> Thanks
>>>
>>> Drive your validation from a Array of data. As you add fields push
>>> into this array the new fields.
>>>
>>> Your validation engine should loop through all the array records to
>>> do validations.
>>>
>>> Suggested Fields in table:
>>> Name - Field Name
>>> Alias - Alias of field (for display purposes if name is abstract)
>>> ControlType - What type of control you are validating
>>> ValidationType - NoNull or Value or NullWarning
>>> DataType - Type of data in field (for value validation)
>>>
>>> Each field type can have more than one record: eg, Null and Value
>>> validation (checks for null / blank and if not null / blank, verify
>>> the content)
>>>
>>> Good luck!
>>>
>>> JsD
>>>
>>>[/color]
>>
>>Thanks. I'm using a onBlur() event to push the field name, which is
>>generated dynamically, directly into the validation script, but the
>>validation script still cannot find the field. Any thoughts?[/color]
>
> If you're using onBlur, why are you using the field name? You should
> be passing a direct reference to the field (eg,
> onchange="validate(this)". Note that I used onchange rather than
> onblur(), because onblur() is almost always a mistake.
>
> You should also choose a subject line that doesn't make you appear
> to be a complete idiot.
>
>[/color]

Already changed to onChange(this), but there's some other problems with
that too.

BTW, why are people online so testy. I didn't filled in the subject line
because I couldn't think of a way to shorten my question in a meaningful
way. That gets me being called a "complete idiot". Jeez, @$$hole.
Mar 8 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.