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

Blank Forms (Javascript Disabled) #14

Open
DubStepMad opened this issue Feb 12, 2020 · 0 comments
Open

Blank Forms (Javascript Disabled) #14

DubStepMad opened this issue Feb 12, 2020 · 0 comments

Comments

@DubStepMad
Copy link

DubStepMad commented Feb 12, 2020

If a user disables Javascript in the browser, they can still submit a form.

Head to:
resources > views > vendor > formbuilder > render > index.blade.php

Replace the Submit button with the following that shows a friendly message:

<noscript>
		<p>This site is best viewed with Javascript. Please allow javascript to run.</p>
	</noscript>

	<script type="text/javascript">
		$(function(){
			$('#Submit').attr('disabled', false);

			var $input = $('<button id="Submit" type="submit" class="btn btn-primary confirm-form" data-form="submitForm"> <i class="fa fa-submit"></i> Submit Form </button>');
			$input.appendTo($("#formSubmit"));

			$('#Submit').attr('data-message', "Submit your entry for '{{ $form->name }}'?");
		});
</script>

The function adds the Submit button for those who have Javascript enabled on their browser otherwise displays the message.

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

1 participant