Why can't I dynamic set text for a HTML Tag attributes?

Im sure Im missing something obvious but I am curious why I can't simply set the text of a HTML tag attribute?

Take for example my code here:

<input
type="{{ showPassword ? 'text' : 'password' }}"
class="form-control form-control-merge"
id="password"
name="password"
v-model="password"
tabindex="2"
placeholder="············"
aria-describedby="password"
/>

This is used in conjunction with a button which on my login page allows for the user to toggle between seeing and not seeing the password they've entered. Toggling the type attrib between text and password should work from what I have seen in another normal template example but in my case the expression itself is in the actual HTML code. I can verify that when clicking the button that the value is indeed toggling. Anyone want to tell me what I am doing wrong?

Thanks!

👍︎ 2
💬︎
👤︎ u/choff5507
📅︎ Jan 16 2022
🚨︎ report
Unable to display HTML form data with "Post" method attribute

Newbie to HTML and CSS here. So I'm working through the book "Head First HTML and CSS, 2nd Edition" and I've run into an issue regarding HTML forms in Chapter 14.

When using the following example form element that the book provides:

<form action="http://starbuzzcoffee.com/processorder.php" method="post">

<p>Ship to: <br>

Name: <input type="text" name="name"> <br>
Address: <input type="text" name="address"> <br>
City: <input type="text" name="city"> <br>
State: <input type="text" name="state"> <br>
Zip: <input type="text" name="zip"> <br>
Phone: <input type="number" name="phone"> <br>
</p>
<p>
    <input type="submit" value="Order Now">
</p>
</form>

None of the data that I enter into the form on the HTML file's webpage (name, address, city, etc.) appears in the confirmation page after submitting the information unless I switch the method attribute to "get" instead of "post".

When using the "post" value for the method attribute, regardless of me entering data into the form, I get the following page as a result: https://starbuzzcoffee.com/processorder.php

The book was written WAY back in 2012, so could it just be that I'm using an outdated method?

Big thanks to anyone who can give me some insight!

👍︎ 6
💬︎
📅︎ Nov 27 2021
🚨︎ report
Organizing HTML tag attributes

Is there some kind of extension that would allow me to set how the HTML attributes should be ordered?

👍︎ 2
💬︎
📅︎ Nov 13 2021
🚨︎ report
Represent State with HTML Attributes, Not Class Names aleksandrhovhannisyan.com…
👍︎ 151
💬︎
📅︎ Sep 17 2021
🚨︎ report
How do JS libraries like Vue/Apline etc create their own custom html attributes?

I'm looking at using AlpineJS and I see that it uses its own attributes like "x-data" for example. In a nutshell, how are these created?

Does the UI library re-compile itself to be valid HTML/Javascript?

👍︎ 4
💬︎
📅︎ Sep 28 2021
🚨︎ report
How to avoid hard coding the value attribute / inner html of a select menu? For Finance
        <select name="symbol">
            {% for row in stocks %}}
            sym = row["symbol"]
            <option value=sym>sym</option>
            {% endfor %}
        </select>

The above is what I have right now, however the issue is that both the inner html of options as well as the value= attribute seem to be hard set to a static string. This is what I mean:

Any inputs appreciated

👍︎ 2
💬︎
👤︎ u/R_xcs
📅︎ Sep 28 2021
🚨︎ report
Perfecting the password field with the HTML passwordrules attribute scottbrady91.com/Authenti…
👍︎ 12
💬︎
📅︎ Jul 13 2021
🚨︎ report
Salesforce Development Tutorial (LWC): How to use Data Attributes in Lightning Web Components to pass data from the HTML Template to the JavaScript Controller

Oh hey everyone! It's been quite a while now. After my Apex Common tutorial series I needed a bit of a break, but I'm back to making development tutorial videos again! This weeks video goes over how to leverage data attributes to pass data from the html template to the JavaScript controller in your Lightning Web Component. I also go over what an event is in JavaScript and the difference between what an event's target and currentTarget are (this is super important to know!).

This can be extremely useful, especially when you are building html elements using for:each templates , tables and several other elements in your components and you need to pass one or more data points to a controller when a JS event is triggered.

I hope it helps someone out there, it has saved me multiple times in more challenging frontend situations.

Link to video: Salesforce Development Tutorial: How to use Data Attributes in LWC's

As always, for the readers out there is a link to a blog post in the video description and there is a github link if you'd rather just check out the code as well.

Also make sure to vote on next weeks video here: Vote on next weeks video!

👍︎ 21
💬︎
👤︎ u/BigIVIO
📅︎ Jul 12 2021
🚨︎ report
the Required attributes are not working in HTML

<!DOCTYPE HTML>

<html> <header> <h1 id="title">Guitar Survey</h1> </header> <body> <p id="description"> Fill out this survey to let us know your favorite style of guitar</p>

<form id="survey-form">

<div class="input-headings">

<label for="name "id="name-label"> Name </label> <input id="name" type="text" name="name" placeholder="Jimi Hendrix" class="form-inputs" required> </input> <br>

<label for="email" id="email-label"> Email </label> <input id="email" type="text" name="email" placeholder="Email@gmail.com" class="form-inputs" required> </input> <br>

<label for="number" id="number-label"> Number of Frets </label> <input id="number" type="number" name="number" placeholder="00" min="21" max="24" class="form-inputs" required> </input> <br>

<label for="dropdown" id="style"> Style of Guitar </label> <select id="dropdown"class="form-inputs"> <option value="Model_S"> Stratocaster </option> <option value="Model_T"> Telecaster </option> <option value="Model_J"> Jaguar </option> <option value="Model_JZ"> Jazzmaster </option> <option value="Model_M"> Mustang </option> </select> <br> <br>

<label for="model_color" id="model_color"> <b> Model Color: </b> </label> <br> <input id="model_color" type="radio" id="black" name="color" value="black"> <label for="model_color"> Black </label> <br>

<input id="model_color" type="radio" id="Sunburst" name="color" value="Sunburst"> <label for="model_color"> Sunburst </label> <br>

<input id="model_color" type="radio" id="red" name="color" value="red"> <label for="model_color"> Red </label> <br>

<input id="model_color" type="radio" id="seafoam green" name="color" value="seafoam green"> <label for="model_color"> Seafoam Green </label> <br> <br>

<label for="features"> <b> Add Features: </b> </label> <br>

<input id="checkbox" type="checkbox" name="Features" value="Kind of wood used for body"> <label for="checkbox"> Alder - $400 </label> <br>

&lt;input id="checkb
... keep reading on reddit ➡

👍︎ 4
💬︎
👤︎ u/stewtech3
📅︎ Jun 23 2021
🚨︎ report
Rails 7 transforms a Ruby hash into HTML attributes for ERB interpolation blog.saeloun.com/2021/05/…
👍︎ 30
💬︎
👤︎ u/vadhiv
📅︎ May 05 2021
🚨︎ report
What is the mechanism behind the name and content attributes for meta tag in html

Can anyone explain me the mechanism behind the name and content attributes in the meta tag in html

👍︎ 3
💬︎
📅︎ Jul 19 2021
🚨︎ report
Typescript - is there any way to filter out invalid attributes for an HTML input based on the type attribute?

So there is the type: -

InputHTMLAttributes&lt;HTMLInputElement&gt;

This is kinda generic and will allow any and all input attributes, including invalid attributes invalid according to the type attribute such as this: -

<input type="reset" placeholder="this" />

Is there any way to drill this down to get rid of none invalid attributes based on the type attribute?

Thanks.

👍︎ 2
💬︎
👤︎ u/U4-EA
📅︎ Jul 16 2021
🚨︎ report
Wrap HTML attributes - what's your preference?

None/Auto

&lt;b·data-foo=""·data-bar=""&gt;&lt;/b&gt;␊
&lt;div·data-foo=""·data-bar=""&gt;&lt;/div&gt;␊
&lt;span·data-foo=""·data-bar=""&gt;&lt;/div&gt;␊
␊
··&lt;input·class="input·is-small"·type="text"·v-model="domainFilter"·placeholder="search"&gt;␊
␊
··&lt;input·type="hidden"·name="theName"·value=""&gt;

Forced

 &lt;b·data-foo=""␊
··data-bar=""&gt;&lt;/b&gt;␊
&lt;div·data-foo=""␊
··data-bar=""&gt;&lt;/div&gt;␊
&lt;span·data-foo=""␊
··data-bar=""&gt;&lt;/div&gt;␊
␊
··&lt;input·class="input·is-small"␊
····type="text"␊
····v-model="domainFilter"␊
····placeholder="search"&gt;␊
␊
··&lt;input·type="hidden"␊
····name="theName"␊
····value=""&gt;

Forced + aligned

&lt;b·data-foo=""␊
···data-bar=""&gt;&lt;/b&gt;␊
&lt;div·data-foo=""␊
·····data-bar=""&gt;&lt;/div&gt;␊
&lt;span·data-foo=""␊
······data-bar=""&gt;&lt;/div&gt;␊
␊
··&lt;input·class="input·is-small"␊
·········type="text"␊
·········v-model="domainFilter"␊
·········placeholder="search"&gt;␊
␊
··&lt;input·type="hidden"␊
·········name="theName"␊
·········value=""&gt;

What's your poison ladies and gents?

View Poll

👍︎ 6
💬︎
👤︎ u/Kinthalis
📅︎ Apr 22 2021
🚨︎ report
Creating ID attributes HTML

So far i am trying to create an ID for the code below , here is the before code

&lt;a data-toggle="tab"  href="#projectSearch"&gt;Project Portal Search&lt;/a&gt;

I so far have added the id="projectSearch" to the HTML and wanted to know if this is accurate??

&lt;a data-toggle="tab" id="projectSearch" href="#projectSearch"&gt;Project Portal Search&lt;/a&gt;
👍︎ 2
💬︎
📅︎ Jun 11 2021
🚨︎ report
Salesforce Development Tutorial (LWC): How to use Data Attributes in Lightning Web Components to pass data from the HTML Template to the JavaScript Controller

Oh hey everyone! It's been quite a while now. After my Apex Common tutorial series I needed a bit of a break, but I'm back to making development tutorial videos again! This weeks video goes over how to leverage data attributes to pass data from the html template to the JavaScript controller in your Lightning Web Component. I also go over what an event is in JavaScript and the difference between what an event's target and currentTarget are (this is super important to know!).

This can be extremely useful, especially when you are building html elements using for:each templates , tables and several other elements in your components and you need to pass one or more data points to a controller when a JS event is triggered.

I hope it helps someone out there, it has saved me multiple times in more challenging frontend situations.

Link to video: Salesforce Development Tutorial: How to use Data Attributes in LWC's

As always, for the readers out there is a link to a blog post in the video description and there is a github link if you'd rather just check out the code as well.

Also make sure to vote on next weeks video here: Vote on next weeks video!

👍︎ 12
💬︎
👤︎ u/BigIVIO
📅︎ Jul 12 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.