Solved

HTML code - set variable value

Posted on 2011-09-23
14
528 Views
Last Modified: 2012-06-21
How do I set my [08]Subject equal to the value selected in [08]Logtypeid when the submit button is push in this page?
<!DOCTYPE html>
<html>
<!-- start right frame -->
<head>
<title>~[text:psx.html.admin_students.newlogentry.new_log_entry]</title>
~[wc:commonscripts]
<link href="/images/css/screen.css" rel="stylesheet" media="screen">
<link href="/images/css/print.css" rel="stylesheet" media="print">~[x:logtypejs]
</head>

<body>

<form action="/admin/changesrecorded.white.html" method="POST">
~[wc:admin_header_frame_css]<!-- breadcrumb start --><a href="/admin/home.html" target="_top">~[text:psx.html.admin_students.newlogentry.start_page]</a> &gt; <a href="home.html?selectstudent=nosearch" target="_top">~[text:psx.html.admin_students.newlogentry.student_selection]</a> &gt; <a href="/admin/students/log.html?frn=~(studentfrn)">~[text:psx.html.admin_students.newlogentry.log_entries]</a> &gt;~[text:psx.html.admin_students.newlogentry.new_log_entry1]<!-- breadcrumb end -->~[wc:admin_navigation_frame_css]

~[wc:title_student_begin_css]~[text:psx.html.admin_students.newlogentry.new_log_entry2]~[wc:title_student_end_css]

<!-- start of content and bounding box -->
<div class="box-round">

<table border="0" cellspacing="0" cellpadding="4">
<tr bgcolor="#f6f6f6">
<td colspan="2" class="bold">~[text:psx.html.admin_students.newlogentry.general_log_information]</td>
</tr>
<tr bgcolor="#edf3fe">
<td class="bold">~[text:psx.html.admin_students.newlogentry.student]</td>
<td>~(studentname)</td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.date_amp_time]</td>
<td><input type="text" name="[08]entry_date" value="~[short.date]" size="12" onChange="checkDates('~(JSFieldParam;[08]entry_date)');"><input type="text" name="[08]entry_time" value="~[time]" size="8"></td>
</tr>
<tr bgcolor="#edf3fe">
<td class="bold">~[text:psx.html.admin_students.newlogentry.author]</td>
<td><input type="text" name="[08]entry_author" value="~[x:username]" size="26"></td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.log_type]</td>
<td><select name="[08]logtypeid" special="lists.logtype" onchange="setMenu(this)"><option></select></td>
</tr>
<tr bgcolor="#edf3fe">
<td class="bold">~[text:psx.html.admin_students.newlogentry.subtype_optional_for_discipline]</td>
<td>~[x:subtype]</td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.consequence_optional_for_discipline]</td>
<td><select name="[08]consequence" special="lists.consequence"><option></select></td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.subject]</td>
<td><input type="text" name="[08]Subject"></td>
</tr>
</td>
</tr>
<tr>
<td class="bold">~[text:psx.html.admin_students.newlogentry.log_entry_text]</td>
<td><textarea name="[08]entry" rows="6" cols="40"></textarea></td>
</tr>

<br>

<div class="button-row"><input type="hidden" name="ac" value="prim"><input type="hidden" name="[08]subtype" value=" "><input type="hidden" name="[08]studentid" value="~(curstudid)">~[submitbutton]</div>
</div>
<br>
<!-- end of content of bounding box -->

~[wc:admin_footer_frame_css]
</form>

</body>
</html><!-- end right frame -->

Open in new window

0
Comment
Question by:TAS-IT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
14 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36591278
Since your 'action' page is an HTML page, you can't.  HTML is strictly a page description language, you can't use it for programming, not even variable substitution.  You need some kind of server side language like ASP or PHP to process your POST data and write a new page.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36593597
<form action="/admin/changesrecorded.white.html" method="POST"
onsubmit="this.elements['[08]Subject'].value=this.elements['[08]Logtypeid'].value">
0
 

Author Comment

by:TAS-IT
ID: 36594815
Hi DaveBalwin,
What about using JavaScript?

Hi mplungian.
I tried the code, but no luck
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36594824
What does "no luck" mean. Errors or missing value?
If we understood what you need to do we could help better. If you are doing what I THINK you are, then my code should work.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36594827
You could use javascript to change a value.  What will you do with it then?
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36594828
Ps: Dave is correct by the way you cannot POST to HTML. Change to get and look at the querystring. I missed the POST
0
 

Author Comment

by:TAS-IT
ID: 36600290
Hi mplungian,
attached is the new code with the code you suggested.  That is the only part that changed from the original posting.  After I inserted the code, when I created a test entry, the value did not copy to [08]subject
0
 

Author Comment

by:TAS-IT
ID: 36600293
the value for [08]subject was blank
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36600700
1: change to get

<form action="/admin/changesrecorded.white.html" method="GET"
onsubmit="this.elements['[08]Subject'].value=this.elements['[08]Logtypeid'].value">

2: in /admin/changesrecorded.white.html add
<script>
alert(location.search)
</script>

and see you should have the value of [08]subject equal to 08]Logtypeid
0
 

Author Comment

by:TAS-IT
ID: 36709977

This is the text box that shows up after I click the submit button.
----
?ac=prim&UF-008013-1=C&UF-008002-1=2623&btnSubmit=&UF-008005-1=09%2F27%2F2011&UF-008006-1=07%3A06+AM&UF-008004-1=Liu%2C+Cong&UF-008012-1=1951&subtype=C&UF-008014-1=Lunch+Detention&UF-008009-1=testing+code+again
----

The [08]Subject is still blank
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36710037
I do not even see [08]studentid

Are we talking about the same form here???

can you give a URL?
0
 

Author Comment

by:TAS-IT
ID: 36714209
The student ID is passing correctly, its passed as a hidden field i believe.  If you look at the code.  On line 62, it reference the studentID.

I am not able to give you the URL as it requires an login credentials to view the data.  I understand this is difficult to solve without see the page so if there are no more suggestions to this, i am going to close the questions and issue out the points.

thanks for all the help and suggestions.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 36714486
Where in the QUERYSTRING you posted are the fields you show in your form???
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 36715569
After I
1: change POST to GET
2: add my script
3: change LogTypeid to logtypeid - javascript is case sensitive
4: add options to your dropdown, I get

[08]entry_date=~[short.date]&[08]entry_time=~[time]&[08]entry_author=~[x:username]&[08]logtypeid=This+is+the+first+value+of+logtypeid&[08]consequence=&[08]Subject=This+is+the+first+value+of+logtypeid&[08]entry=&ac=prim&[08]subtype=+&[08]studentid=~(curstudid)


<form...  method="GET" onsubmit="this.elements['[08]Subject'].value=this.elements['[08]logtypeid'].value">
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question