ColdFusion - how to edit a record? [closed] - coldfusion

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I want to edit the Record2 but when I click the Edit button it always display the info of Record1. If I click any other Edit buttons it only display the info of Record1. How does it know which record I want to edit? Please help. Thank you.
<cfform name="formName" action="edit.cfm" method="post">
....some additional codes.....
<cfloop query="qryName">
Record1_data Edit button
Record2_data Edit button
Record3_data Edit button
Record4_data Edit button
</cfloop>
....some additional codes.....
</cfform>

Unless there's a really good reason I'd really shy away from using cfform there's rarely a good reason to use it
You need to pass in some sort of form variable that has the corresponding ID to what you're pulling into the database.
<form name="formName" action="edit.cfm" method="post">
<cfloop query="qryName">
<input type="checkbox" name="Record" value="#qryName.ID#" /> Record #qryName.ID#
</cfloop>
</form>

Related

Flask-Admin - what to pass in url_for(' ')? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I got an error, that says, that no URL can be build from that parameter inside url_for('').
I passed url_for('admin') but that does not work. What should I pass to get to localhost:5000/admin ?
Thank you
You pass the name of the definition of the route you want to visit.
For example:
#app.route('/')
def index():
return 'Hello, World!'
...
#app.route('/some_page')
def somewhere_else():
if something_happened:
redirect(url_for('index'))
return render_template('some_page.html')
Or if you are using it inside your HTML:
<a href="{{ url_for('index') }} ...></a>

Django: How to populate value into form template? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have created a small form which includes something like name, mobile number, age field. All are text fields.
These values are stored in DB.
I want my template to pre-populate the form with values from DB (if exists). How can this be done?
My template code is as below:
<div>
<center><form action="/profilesettings/" method="post" enctype="multipart/form-data">{% csrf_token %}
{{form.as_p}}
<input type="submit" value="submit">
</form></center></div>
Currently, it displays form with empty field. Instead of empty fields, I would like them to show values which are fetched from DB.
check this example on django docs
article = Article.objects.get(pk=1)
article.headline
'My headline'
form = ArticleForm(instance=article)
form['headline'].value()
'Initial headline'

In a Flask app, how to print each item of a list in the new paragraphs inside my HTML page [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm building a Flask app which is supposed to return all the items in a list as a new line in the HTML page.
For example:
list = [1,2,3,4]
I want to print each item in list as a new paragraph in my HTML page, like here:
<p>1</p>
<p>2</p>
<p>3</p>
<p>4</p>
You should better follow the flaskr tutorial on flask web site. It can give you the idea how to pass local variables to the template.
#app.route('/')
def your_view():
your_list= [1,2,3,4]
return render_template('your_view.html', your_list=your_list)
then in your jinja template, iterate over this list.
{% for your_list_element in your_list %}
<p>{{ your_list_element }} </p>
{% endfor %}

How can I upload a file or we can say choose a file from the system in Visual C++ Form Application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
As I want to make an application in which a user can choose a Image file for the Image processing that is in my sense some thing dynamic image. In html this is some thing like this
<h1>File Upload with Jersey</h1>
<form action="rest/hello/upload" method="post" enctype="multipart/form-data">
<p>
Select a file : <input type="file" name="file" size="45" />
</p>
Now how to make this this thing in VC++.
Please Suggest me some tutorial or some thing help full.
Thanks in Advance.
Here is the code for this task
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
// Displays an OpenFileDialog so the user can select a Cursor.
OpenFileDialog ^ openFileDialog1 = gcnew OpenFileDialog();
openFileDialog1->Filter = "Cursor Files|*.cur";
openFileDialog1->Title = "Select a Cursor File";
// Show the Dialog.
// If the user clicked OK in the dialog and
// a .CUR file was selected, open it.
if (openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK)
{
// Assign the cursor in the Stream to
// the Form's Cursor property.
this->Cursor = gcnew
System::Windows::Forms::Cursor(
openFileDialog1->OpenFile());

HTML5 - simple pattern don't works with Smarty [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm using a simple pattern like this :
<input type="text" pattern="[a-z]{2}" required ../>
But it's never valid. It seems it didn't works.
I tested it in Firefox
Is there something to active or something like that ?
My template :
<section class="inscription">
<h1>Inscription</h1>
<form method="post" enctype="multipart/form-data">
<div class="formu-inscription">
<label for="nom"> Nom : </label> <br/><input type="text" id="nom" name="nom" value="{set_value('nom')}" pattern="[a-z]{2}" required /> <br />
{form_error('nom')}
/* others inputs */
For people using smarty template, you can do
pattern="[a-z]{literal}{2}{/literal}"
Looking at the rendered source code you posted as a comment on a now deleted answer you have
<input type="text" id="nom" name="nom" value="" pattern="[a-z]2" required />
This is not the pattern in your source that you posted in your question. It seems that you are using some unspecified templating system that is using the {} characters as field identifiers and is misinterpreting your pattern.
The result in your rendered page is the pattern [a-z]2, which will validate for a string like a2 or f2, but not a, or aa, a3 or anything longer.
Since you haven't specified what templating system you're using it's not possible to indicate how you might work around this. Possibly a pattern of [a-z]{{2}} might work.