Rectangle 27 12

How about creating an <input type="hidden"> (with no name or outside the form so it's not submitted) in which you store an encoded list of extra fields to add and their values? While the browser won't remember newly-added fields on back, it will remember the values of hidden fields that were in the form from the start.

Here's an example that saves the extra fields on document unload and retrieves them on ready:

<input type="hidden" id="remembertexts" />

<form action="http://www.google.com/" method="get">
    <div id="texts">
        <input type="text" name="text[]" value="" />
    </div>
    <div>
        <input type="submit" />
        <input type="button" id="addtext" value="+" />
    </div>
</form>

<script type="text/javascript">

    // Add new field on button press
    //
    $('#addtext').click(function() {
        addInput('');
    });

    function addInput(text) {
        $('#texts input').eq(0).clone().val(text).appendTo('#texts');
    };

    // Store dynamic values in hidden field on leaving
    //
    $(window).bind('beforeunload', function() {
        var vals= [];
        $('#texts input').each(function() {
            vals.push(encodeURIComponent(this.value));
        });
        $('#remembertexts').val(vals.join(';'));
    });

    // Retrieve dynamic values on returning to page
    //
    $(function() {
        var extratexts= $('#remembertexts').val().split(';').slice(1);
        $.each(extratexts, function() {
            addInput(decodeURIComponent(this));
        });
    });
</script>

This is totally genious! No need for sessions, AJAX, cookies and all that stuff! Great!

javascript - Back Button Handle A Dynamic Form - Stack Overflow

javascript html forms back-button
Rectangle 27 6

One of my favorite methods is to obfuscate the email address using php, a classic example is to convert the characters to HEX values like so:

function myobfiscate($emailaddress){
 $email= $emailaddress;                
 $length = strlen($email);                         
 for ($i = 0; $i < $length; $i++){                
 $obfuscatedEmail .= "&#" . ord($email[$i]).";";
 }
 echo $obfuscatedEmail;
}

And then in my markup I'll simply call it as follows:

<a href="mailto:<?php echo myobfiscate('someone@somewhere.com')" title="Email me!"><?php echo myobfiscate('someone@somewhere.com');</a>

html - Effective method to hide email from spam bots - Stack Overflow

html algorithm email spam
Rectangle 27 1

I used to do this a lot when I worked with Classic ASP. Usually I used it when server-side validation was needed of some sort for the input (before the days of AJAX). The main draw back I see is that it doesn't separate programming logic from the presentation, at the file level.

why not? I think it's not connected. I can have a form post the data to the same page and build this page with proper separation of controller and view.

web standards - Is it a good practice to use an empty URL for a HTML f...

forms web-standards string html
Rectangle 27 1

I used to do this a lot when I worked with Classic ASP. Usually I used it when server-side validation was needed of some sort for the input (before the days of AJAX). The main draw back I see is that it doesn't separate programming logic from the presentation, at the file level.

why not? I think it's not connected. I can have a form post the data to the same page and build this page with proper separation of controller and view.

web standards - Is it a good practice to use an empty URL for a HTML f...

forms web-standards string html
Rectangle 27 1

I used to do this a lot when I worked with Classic ASP. Usually I used it when server-side validation was needed of some sort for the input (before the days of AJAX). The main draw back I see is that it doesn't separate programming logic from the presentation, at the file level.

why not? I think it's not connected. I can have a form post the data to the same page and build this page with proper separation of controller and view.

web standards - Is it a good practice to use an empty URL for a HTML f...

forms web-standards string html
Rectangle 27 4

There's two pieces to this. Chrome and other browsers will remember previously entered values for field names, and provide an autocomplete list to the user based on that (notably, password type inputs are never remembered in this way, for fairly obvious reasons). You can add autocomplete="off" to prevent this on things like your email field.

However, you then have password fillers. Most browsers have their own built-in implementations and there's also many third-party utilities that provide this functionality. This, you can't stop. This is the user making their own choice to save this information to be automatically filled in later, and is completely outside the scope and sphere of influence of your application.

html - Disabling Chrome Autofill - Stack Overflow

html forms google-chrome autocomplete autofill
Rectangle 27 3

There's two pieces to this. Chrome and other browsers will remember previously entered values for field names, and provide an autocomplete list to the user based on that (notably, password type inputs are never remembered in this way, for fairly obvious reasons). You can add autocomplete="off" to prevent this on things like your email field.

However, you then have password fillers. Most browsers have their own built-in implementations and there's also many third-party utilities that provide this functionality. This, you can't stop. This is the user making their own choice to save this information to be automatically filled in later, and is completely outside the scope and sphere of influence of your application.

html - Disabling Chrome Autofill - Stack Overflow

html forms google-chrome autocomplete autofill
Rectangle 27 3

There's two pieces to this. Chrome and other browsers will remember previously entered values for field names, and provide an autocomplete list to the user based on that (notably, password type inputs are never remembered in this way, for fairly obvious reasons). You can add autocomplete="off" to prevent this on things like your email field.

However, you then have password fillers. Most browsers have their own built-in implementations and there's also many third-party utilities that provide this functionality. This, you can't stop. This is the user making their own choice to save this information to be automatically filled in later, and is completely outside the scope and sphere of influence of your application.

html - Disabling Chrome Autofill - Stack Overflow

html forms google-chrome autocomplete autofill
Rectangle 27 3

There's two pieces to this. Chrome and other browsers will remember previously entered values for field names, and provide an autocomplete list to the user based on that (notably, password type inputs are never remembered in this way, for fairly obvious reasons). You can add autocomplete="off" to prevent this on things like your email field.

However, you then have password fillers. Most browsers have their own built-in implementations and there's also many third-party utilities that provide this functionality. This, you can't stop. This is the user making their own choice to save this information to be automatically filled in later, and is completely outside the scope and sphere of influence of your application.

html - Disabling Chrome Autofill - Stack Overflow

html forms google-chrome autocomplete autofill
Rectangle 27 3

There's two pieces to this. Chrome and other browsers will remember previously entered values for field names, and provide an autocomplete list to the user based on that (notably, password type inputs are never remembered in this way, for fairly obvious reasons). You can add autocomplete="off" to prevent this on things like your email field.

However, you then have password fillers. Most browsers have their own built-in implementations and there's also many third-party utilities that provide this functionality. This, you can't stop. This is the user making their own choice to save this information to be automatically filled in later, and is completely outside the scope and sphere of influence of your application.

html - Disabling Chrome Autofill - Stack Overflow

html forms google-chrome autocomplete autofill
Rectangle 27 12

You can add a disabled attribute to them in the submit handler, this will prevent them from being serialized, either by jQuery or a normal <form> submission. For example:

$("#myForm").submit(function() {
  $(this).find(":radio, :checkbox").attr("disabled", true);
});

Or you can .serialize() only the elements you want, for example:

$.post("myPage.cgi", $("#myForm input[type=text]").serialize());
.prop('disabled', true)

javascript - How can I exclude HTML form radio button values from bein...

javascript jquery forms
Rectangle 27 1

The solutiton that you found doesn't do what you describe. It only presents the data from the XML as a form, and lets the user edit the values. That's not very complex, and you can do that using pretty much any other server side language, like PHP for example.

What you describe, on the other hand, is quite complex. It involves examining the XSL and the HTML to identify the parts of the HTML code that was created using specific XML data, so that changes can be reflected back. That's not something that is done with a simple ASP script like that.

Oh I see..you're right I misunderstood what the example did. I already have it editing the fields in the form. So when they do edit it, and I want to save it back to xml, it's more complex than I thought..but on one hand I'm restricted to mainly converting html tags to xml. How should I tackle this then? Go through and look at each individual tag with the case of a href, and change it to xref, etc?

XML -> XSL -> HTML edit file, and SAVE changes in xml WITHOUT asp - St...

html xml xslt asp-classic save
Rectangle 27 2

See also the second answer here. It describes how to retrieve values from a field with multiple instances on a form as an array. I have to say though, I've been working in CFML for many years, and I've yet to do this myself, or see it done in any app I've worked on. I think that's just because avoiding commas is very much simpler, but if you can't or don't want to work around it that way, it is possible.

html - Working with Form Arrays in ColdFusion? - Stack Overflow

html arrays coldfusion
Rectangle 27 7

Actually, this is an ongoing problem. While Andy is right about the downloaded source, .val(...) and .attr('value',...) don't seem to actually modify the html. I think this is a javascript problem and not a jquery problem. If you had used firebug even you would have had the same question. While it seems that if you submit the form with the modified values it will go through, the html does not change. I ran into this issue trying to create a print preview of the modified form (doing [form].html()) it copies everything okay, including all changes except values changes. Thus, my modal print preview is somewhat useless... my workaround may have to be to 'build' a hidden form containing the values they have added, or generate the preview independently and make each modification the user makes also modify the preview. Both are inoptimal, but unless someone figures out why the value-setting behavior does not change the html (in the DOM i'm assuming) it will have to do.

+1 from me ! You're right. value and .val() has having problem while updating it using jQuery. Did you found anything around?

Set value of hidden field in a form using jQuery's ".val()" doesn't wo...

jquery set hidden-fields
Rectangle 27 7

Actually, this is an ongoing problem. While Andy is right about the downloaded source, .val(...) and .attr('value',...) don't seem to actually modify the html. I think this is a javascript problem and not a jquery problem. If you had used firebug even you would have had the same question. While it seems that if you submit the form with the modified values it will go through, the html does not change. I ran into this issue trying to create a print preview of the modified form (doing [form].html()) it copies everything okay, including all changes except values changes. Thus, my modal print preview is somewhat useless... my workaround may have to be to 'build' a hidden form containing the values they have added, or generate the preview independently and make each modification the user makes also modify the preview. Both are inoptimal, but unless someone figures out why the value-setting behavior does not change the html (in the DOM i'm assuming) it will have to do.

+1 from me ! You're right. value and .val() has having problem while updating it using jQuery. Did you found anything around?

Set value of hidden field in a form using jQuery's ".val()" doesn't wo...

jquery set hidden-fields
Rectangle 27 1

The problem was that there was function further up the page that was partially applying some encoding, specifically the ampersand was being encoded. Thus my function as shown above, was double-encoding the value.

HTML attribute encoding the value attribute of an INPUT tag in classic...

asp-classic html-encode
Rectangle 27 1

The problem is that you add the group address to the formbuilder groups in the parent component but the html is added as a child component which cannot update your formgroup values.

Using the parent-child approach, you need to output the change of the value from the child component to the parent component when the value change and then set the value of your form group manually, take a look here for some different ways of communicating between parent-child components: https://angular.io/docs/ts/latest/cookbook/component-communication.html

To me, it looks easier if you could use ngFor or ngIf directives to control your dynamic form instead of adding child components. Take a look here for an example of how to do this: https://angular.io/docs/ts/latest/cookbook/dynamic-form.html

@hanger thanks for the reply, but my situation is that I dont have the luxury of working here with dynamic forms. The html comes from the table which need to be manipulated to add inputs to be presented to the user to fill it in. I do understand i added the form group in the top, I am not sure how to handle it after the dynamic HTML is displayed. I have worked on dynamic forms, but dynamic forms is not going to work since the content of Forms Inputs are part of html from database and need to display it dynamically.

If you get html from your database you can bind the innerHtml property of a div to your html string to have the html displayed. But if this solution does not work then you need to use one of the ways to communicate between parent and child that is outlined in the angular cookbook in the original answer.

I tried using inner html to bind and it works fine and it shows the html and the input values, but the problem is I am not able to get the values back to parent. That is where i need help.

Ok, would you mind updating your post to show how you did when binding to inner html. To be clear - I talk about updating your template with a div like this: <div [innerHtml]="htmlString"></div>. There is no parent-child relationship with this approach because the html string and the values will all be on the parent.

Here you go. This is using div InnerHTML. I am using safeHTML so the values Input fields are not stripeed plnkr.co/edit/Pgd81dg5tBuraSXkDBe6?p=preview When you add some values and submit, you will not get the values for address. This is the problem I am having

angular - How to get form values from dynamic HTML In angular2 - Stack...

angular typescript
Rectangle 27 12

Add the attribute autocomplete="off" to each of your form elements.

This is not part of the W3C HTML standard, but it does work in both Mozilla & IE browsers.

In which standard is this defined? In which browser is this implemented?

It is not defined in any standard, but I haven't seen a browser that does autocomplete that does not obey this tag.

javascript - how to avoid listing previously entered values in certain...

php javascript html
Rectangle 27 2

You have to give all inputs a name property, which will add the values to the array:

<form action="/signup.php" method="post">
    <input type="password" id="signupPassword" placeholder="Password">

    <input type="text" name="signupEmail" placeholder="Email"> 

    <input type="text" name="signupphoneNumber" placeholder="Phone Number">

    <input type="submit" name="signupSubmit">
</form>

php - HTML form not POSTing - Stack Overflow

php html