Asked  7 Months ago    Answers:  5   Viewed   27 times

What is the difference between HTML <input type='button' /> and <input type='submit' />?



<input type="button" /> buttons will not submit a form - they don't do anything by default. They're generally used in conjunction with JavaScript as part of an AJAX application.

<input type="submit"> buttons will submit the form they are in when the user clicks on them, unless you specify otherwise with JavaScript.

Tuesday, June 1, 2021
answered 7 Months ago

Console.Read() reads only the next character from standard input, and Console.ReadLine() reads the next line of characters from the standard input stream.

Standard input in case of Console Application is input from the user typed words in console UI of your application. Try to create it by Visual studio, and see by yourself.

Saturday, June 5, 2021
answered 7 Months ago

I looked at this and just tried this on my Xoom with the built in browser and FF mobile (with a desktop UA string) and the tel input would seem to work just fine for this.


Friday, July 30, 2021
answered 5 Months ago

Right now, there isn't a huge deal between them - maybe there never will be. However, the point is to give the browser-makers the ability to do something special with it, if they want.

Think about <input type="number"> on cellphones, bringing up number pads, or type="email" bringing up a special version of the keyboard, with @ and .com and the rest available.

On a cellphone, search could bring up an internal search applet, if they wanted.

On the other side, it helps current devs with css.

input[type=search]:after { content : url("magnifying-glass.gif"); }
Saturday, September 4, 2021
Samir Sabri
answered 3 Months ago

Both interfaces exist for different purposes. The InputFilterAwareInterface guarantees that implemented classes will have a setInputFilter() and getInputFilter() methods which accept and return an InputFilter instance when necessary. On the other hand, the InputFilterProviderInterface guarantees only that implemented classes will have a getInputFilterSpecification() method which returns a filter specification (configuration array) which is ready to use as argument in various input factories.

For example; the snippet below came from ZendFormForm.php class:

if ($fieldset === $this && $fieldset instanceof InputFilterProviderInterface) {
    foreach ($fieldset->getInputFilterSpecification() as $name => $spec) {
        $input = $inputFactory->createInput($spec);
        $inputFilter->add($input, $name);

As you can see, the Form class creates inputs and binds them to related filter using given specification which is returned by getInputFilterSpecification() method of the implementing class ($fieldset int this case).

Using Traits

Zend Framework 2 also provides lot of traits for commonly used interfaces. For example InputFilterAwareTrait for InputFilterInterface. This means, you can easily implement that interface if you have PHP >= 5.4

namespace MyNamespace;

use ZendInputFilterInputFilterInterface;

MyClass implements InputFilterInterface {

    // Here is the trait which provides set and getInputFilter methods
    // with a protected $inputFilter attribute to all MyClass instances.

    use ZendInputFilterInputFilterAwareTrait;

    // Your other methods.

Now anywhere in your code, you can do this:

$myClass->getInputFilter(); // Returns an inputfilter instance.

As you can imagine, no trait exists for InputFilterProviderInterface because its responsibility is only returning a valid config spec. It doesn't deal with any instance or class attribute like is forced in InputFilterInterface.

Friday, December 3, 2021
answered 4 Days ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :