开发者

Use multiple forms or or add form with jQuery in CMS type application

开发者 https://www.devze.com 2023-03-11 19:20 出处:网络
I\'ve got a CRUD type application for Job Postings. I want the user to be able to edit the postings from the admin page.

I've got a CRUD type application for Job Postings. I want the user to be able to edit the postings from the admin page.

Is it better to have a hidden form under each job posting that when the user clicks 'Edit' I .show() the form, or is it smarter to append the div with the form upon clicking 'Edit'?

The form is very simple; 'Title' and 'Description'.

What's the best practice here? What is the easiest to code? Would it be easier to append because I only have to va开发者_开发百科lidate one form rather than sorting out multiple forms?

I'm using AJAX to process the form submission in a ColdFusion environment.

Thank you in advance.


Neither, use one form and show it as a jQuery modal dialog when you click the edit button. Submit saves the data via AJAX (again using jQuery I'd imagine), clears the form, and hides it. Adding can use the same form, just blank.


I'm a believer in progressive enhancement and making sure your application works even with JavaScript disabled, but this is a philosophical position. As far as sorting out multiple forms, it's not that huge of a technical issue in my view, especially if your form is relatively simple. What is the main challenge you're concerned about with respect to that?

0

精彩评论

暂无评论...
验证码 换一张
取 消