|
Posted by Ethilien on 10/13/05 02:09
To answer your questions:
1) No, there is no way to make data show up in both fields because the
script you are currently using is probably echoing the data directly
into a value attribute of the elements themselves. Also, by making two
different elements in the same form have the same name, and two
different page elements have the same id, you are introducing a level of
instability into the DOM that could result in no data being submitted at
all if some browsers do not handle multiple occurrences of the same id
in a page the same way (such as submitting the value from the first
occurrence of the name rather than the last, resulting in the input in
the hidden form being used).
2) Javascript would be your only hope of doing this, but as I said
regarding the DOM, their is no way to independently access two page
elements with the same id, so even Javascript cannot do this.
I would recommend that, even though the application does not allow
templating, you can still change its source code for displaying the form
to allow you to template it that way.
Hope this helps,
-Connor Mckay
Alnisa Allgood wrote:
> Hi-
>
> I'm in a situation where I'm required to deal with a hidden form. The
> background details are exhausting, but the gist is: one form is
> auto-generated and lacks proper formatting. It was part of an open
> source package that DID NOT allow templating. So to keep using the
> application engine, but provide formatting, I created a CSS class to
> hide the unformatted form while displaying the formatted form.
>
> When submitting data to the database this doesn't seem to cause any
> issues. It accepts data based on the fieldvalues and ids. But when
> retrieving data to repopulate the form, what happens is that the
> hidden form gets the values and the displayed form does not.
>
> http://nahic.ucsf.edu/phpESP/survey.php
> login= Wisconsin
>
> Basically, if you complete the required field (state), fill out some
> random data, hit save, then select "resume" from the info page
> provided. You'll get back an empty form. But if you look at the code
> you'll see that the hidden form has the values.
>
> So I have a few questions:
>
> 1) Is there anyway to echo data from one field to the next, especially
> if the field (name or id) are exactly the same?? (i.e. field=state
> value=Wisconsin; if the field state is then repeated somewhere else on
> the page, can the value, Wisconsin, also be automatically repeated.
>
> 2) If yes, to the above can PHP do this and how? or is this something
> requiring Javascript or some other coding.
[Back to original message]
|