Component form posting to another view/form

已查看 26 次
跳至第一个未读帖子

Thomas Deliduka

未读,
2018年4月15日 23:10:192018/4/15
收件人 Joomla! General Development
I'm pretty new at this and I'm working through building a component from scratch. I have gone through the "HelloWorld" tutorials already. I'm stuck on this strange thing:

The default view for the "site" side of my component has a form on it. A person submits the form and it adds a database entry and an e-mail is sent. This works perfectly.

The second part is where someone gets the e-mail and it posts to a different view which has a form on it that they update the same database record. It is essentially an edit of the record in the same table, but most of the fields are set to read only so they can't edit those parts. Only update one field.

So, the initial call (that is working) is:

index.php?option=com_mycomp

while the second form is: index.php?option=com_mycomp&view=reqdeny&layout=edit&reqid=xx (id in the db)

Now the <form> tag is set to post to: index.php?option=com_mycomp&view=reqdeny&layout=edit&reqid=xx

But what I am finding is when someone submits, it is executing the validation routines on the original first form and failing validation. My controller file for this view "reqdeny" has no validation listed in it, though. The second form has no validation at all. It is as if it's posting to the original form instead and trying to save data that way.

How do I get it to post to the other view? Or am I thinking of this completely the wrong way?

Viper

未读,
2018年4月16日 02:52:142018/4/16
收件人 Joomla! General Development
In other words...
You have one form definition and two layouts(add and edit) and one view which render this form.
I don't know why validation failded on readonly and disabled fields, but you can check current layout and save it w/o validation.

Thomas Deliduka

未读,
2018年4月16日 08:36:012018/4/16
收件人 Joomla! General Development
Well, not really. Perhaps that's what I should do.

I have two different xml files files defining the form fields. a request-form.xml and deny-form.xml file.  Perhaps I inadvertently have one form but I didn't mean to.

The field "event date" which is failing validation doesn't exist in the deny-form.xml because it wasn't important to include in the deny-form.xml perhaps I should just include it as a read-only field or hidden and then it will work?

Viper

未读,
2018年4月16日 12:45:162018/4/16
收件人 Joomla! General Development
You can have one form with all fields, but set required field attributes in the model. It's really not necessary to have two forms with "one field" difference.

Thomas Deliduka

未读,
2018年4月16日 13:18:022018/4/16
收件人 Joomla! General Development
I guess my concern is that the one person makes the request. Then the authorized person denies the request with a reason. That is the field that is getting updated in the second form. How do you display one form with all the fields except for the the "deny reason" field to one person and then the same form with everything readonly except for the deny reason to the second person?

Wouldn't I need two XML files for that to differentiate?


Viper

未读,
2018年4月16日 13:41:122018/4/16
收件人 Joomla! General Development

Thomas Deliduka

未读,
2018年4月16日 13:46:332018/4/16
收件人 joomla-de...@googlegroups.com
Up to this point I wasn't going to mess with Access Controls because they scare me but I guess I can try this. I need to learn about all that first, then. :-)


Regards,

Thomas Deliduka


--
You received this message because you are subscribed to a topic in the Google Groups "Joomla! General Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/joomla-dev-general/X8Nzs3v8C4Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-dev-general@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

回复全部
回复作者
转发
0 个新帖子