update process adds attribute when button changed from type 'submit' to 'image'

0 views
Skip to first unread message

Confucius

unread,
Dec 22, 2009, 2:36:55 PM12/22/09
to JavaScriptMVC
Hello,

Working with 'edit.ejs' in a simple 'CRUD' application, I changed the
'update' button type from 'submit' to 'image' (with a src attrib). Now
when I update, an extra empty attribute gets added to the Model. If I
give this image input a 'value', then this value gets added to the
Model. When I also do this to the 'cancel' link, I get two extra
attributes/fields added to the Model instance.

So its like all inputs which are not of type 'submit' get added to the
Model, so I guess I need to extend somewhere to exclude image inputs
for this. It's a little funny because image inputs don't normally
appear as fields in an HTTP POST, but sure do here.

Am I not supposed to use image inputs is EJS templates?

Justin Meyer

unread,
Dec 22, 2009, 3:31:22 PM12/22/09
to javasc...@googlegroups.com
It's not ejs. It's form params. It should be removing image button
types.

Sent from my iPhone

> --
>
> You received this message because you are subscribed to the Google
> Groups "JavaScriptMVC" group.
> To post to this group, send email to javasc...@googlegroups.com.
> To unsubscribe from this group, send email to javascriptmv...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/javascriptmvc?hl=en
> .
>
>

Confucius

unread,
Dec 22, 2009, 4:04:19 PM12/22/09
to JavaScriptMVC
OK, I revised 'getParams' to also skip 'image' types, like this:

if(el.type && (el.type.toLowerCase()=='submit' || el.type.toLowerCase
()=='image')) return;

On Dec 22, 1:31 pm, Justin Meyer <justinbme...@gmail.com> wrote:
> It's not ejs. It's form params. It should be removing image button  
> types.
>
> Sent from my iPhone
>

Reply all
Reply to author
Forward
0 new messages