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

Input required attribute not working in options modal #274

Closed
danyj opened this issue Feb 22, 2015 · 18 comments
Closed

Input required attribute not working in options modal #274

danyj opened this issue Feb 22, 2015 · 18 comments

Comments

@danyj
Copy link
Contributor

danyj commented Feb 22, 2015

I need a required option attribute that will not let user save the options unless the option has been filled out.
I am using short-text or text, but in general is there and attribute we can add to make user fill out the option before save?

@ghost
Copy link

ghost commented Feb 22, 2015

Try

array(
    'type' => 'text',
    'attr' => array('required' => 'required'),
)

@danyj
Copy link
Contributor Author

danyj commented Feb 22, 2015

It does show required
http://screencast.com/t/FkB6KD0F
but saving still goes trough without warning.

@ghost
Copy link

ghost commented Feb 22, 2015

You did not specified that options are inside modal.
At the moment the required attribute won't work in modal. I will take a look to see if it's possible to make it work.

@lgabeskiria
Copy link

Hi,
I found a solution for required attributes. You need a hidden submit input inside form.
when you click save button than trigger click on hidden submit input > event.preventDefault() > call your ajax handler and finally return false. I tested this solution and it works fine!

@ghost
Copy link

ghost commented Mar 4, 2015

@levan1993 Thank you for the suggestion. Yes, for the question with required inputs inside options modal this is the solution.

But I am thinking a way to auto-generate a unique id without bothering the user to enter manually one for each section/column.

@lgabeskiria
Copy link

Do you want to generate unique id while building page or on post save ?

@ghost
Copy link

ghost commented Mar 4, 2015

@levan1993 I don't know yet. I will let you know when I will decide.

@lgabeskiria
Copy link

Do you need these ids for CSS stuff?

@ghost
Copy link

ghost commented Mar 4, 2015

Ops, I thought this is #275

The solution for this issue is #274 (comment) I will fix it soon.

@ghost ghost changed the title Is there a required option attribute? Input required attribute not working in options modal Mar 4, 2015
@ghost ghost added the bug label Mar 4, 2015
@ghost
Copy link

ghost commented Mar 11, 2015

I can't solve this

@ghost ghost added the help wanted label Mar 11, 2015
@danyj
Copy link
Contributor Author

danyj commented Mar 11, 2015

Hack but works
http://jsfiddle.net/r8haxLyj/

@danyj
Copy link
Contributor Author

danyj commented Mar 11, 2015

This combo might help also for multiple required
http://stackoverflow.com/a/8409472/594423

@ghost
Copy link

ghost commented Mar 11, 2015

The user will not understand why modal is not closing when he clicks the Save button. The warning popup must be displayed.

@ghost
Copy link

ghost commented Mar 11, 2015

P.S. Is this feature still needed if section id will be generated automatically?

@danyj
Copy link
Contributor Author

danyj commented Mar 11, 2015

adding a class to required on click if it is empty can help there, like here
http://joomlatemplates.youjoomla.info/eximium/index.php/pages/user-pages/login-form

like this
http://jsfiddle.net/r8haxLyj/1/

@danyj
Copy link
Contributor Author

danyj commented Mar 11, 2015

well no it is not needed for me if I have the ID but someone else might want to use required in popup.

@ghost
Copy link

ghost commented Mar 11, 2015

well no it is not needed for me if I have the ID but someone else might want to use required in popup.

If will be needed I will reopen this. (There are other important issues in pending)

@ghost ghost closed this as completed Mar 11, 2015
@lgabeskiria
Copy link

My solution shows browser native validation ( shows native bubbles ), for example :
if input is required it will show : please fill out this field,
if input is url and it'not valid it will show : Please enter a URL.
And so on.

I will modify your fw.OptionsModal and upload it

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

No branches or pull requests

2 participants