Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model generator - Ajax validation breaks form submission #126

Closed
beukeshu opened this issue Jan 17, 2016 · 1 comment
Closed

Model generator - Ajax validation breaks form submission #126

beukeshu opened this issue Jan 17, 2016 · 1 comment

Comments

@beukeshu
Copy link

I am using Postgresql database, and things go wrong when I use a table name containing a schema.

This sequence of actions causes the bug:

  1. I add the table name in the "Table Name" field (eg. my.newtable)
  2. When the browser unfocusses from that field, a model name is automatically generated for the "Model Name" field, "My.newtable". But this generated name contains a period character, causing the error "Only word characters are allowed."
  3. All is normal up to this point. Then, I remove the period character from the "Model Name" field, which causes the validation error to go away
  4. When I then click the "preview" button, nothing happen except the browser scrolling up to the "Model Name" field. The (valid) form does not get submitted at all.

To work around this problem, I do the following:

  1. Refresh the /gii/default/view?id=model view
  2. Fill in the "Model Name" field first, so that it does not get autopoplated with the invalid period character from the table name. Thus, the validation error never triggers
  3. Then I fill in the table name, and continue as usual

The quick fix is likely to strip out any periods in Gii's model Generator:generateClassName() method. It is generating model names which are invalid.

@samdark
Copy link
Member

samdark commented Jul 7, 2016

Merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants